Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2016-10-13 20:32:10 +0300
committerRobert Schilling <rschilling@student.tugraz.at>2016-10-14 15:16:27 +0300
commit04593581037bca7a7c3b00c719404e610c158cc1 (patch)
treebbdf004bd6d7ae543ffe7fb22be5259762150227 /lib
parentfbeaa7518d8cf86ad62e94e9bc86ffe63715dffd (diff)
API: Fix Sytem hooks delete behavior
Diffstat (limited to 'lib')
-rw-r--r--lib/api/system_hooks.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/api/system_hooks.rb b/lib/api/system_hooks.rb
index 2e76b91051f..794e34874f4 100644
--- a/lib/api/system_hooks.rb
+++ b/lib/api/system_hooks.rb
@@ -56,12 +56,10 @@ module API
requires :id, type: Integer, desc: 'The ID of the system hook'
end
delete ":id" do
- begin
- hook = SystemHook.find(params[:id])
- present hook.destroy, with: Entities::Hook
- rescue
- # SystemHook raises an Error if no hook with id found
- end
+ hook = SystemHook.find_by(id: params[:id])
+ not_found!('System hook') unless hook
+
+ present hook.destroy, with: Entities::Hook
end
end
end