diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 21:09:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 21:09:25 +0300 |
commit | 967812838c7e7742729a4c7aeb9859f98a509622 (patch) | |
tree | 22db2e6642be51cb12535db7863331457e5523c3 /lib/gitlab/http.rb | |
parent | 074d013e1eb3f6e0c27f96a3be8b9361254c8a98 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/http.rb')
-rw-r--r-- | lib/gitlab/http.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/gitlab/http.rb b/lib/gitlab/http.rb index 58bce613a98..911b71c3734 100644 --- a/lib/gitlab/http.rb +++ b/lib/gitlab/http.rb @@ -25,5 +25,17 @@ module Gitlab rescue HTTParty::RedirectionTooDeep raise RedirectionTooDeep end + + def self.try_get(path, options = {}, &block) + log_info = options.delete(:extra_log_info) + self.get(path, options, &block) + + rescue *HTTP_ERRORS => e + extra_info = log_info || {} + extra_info = log_info.call(e, path, options) if log_info.respond_to?(:call) + + Gitlab::ErrorTracking.log_exception(e, extra_info) + nil + end end end |