diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 18:09:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 18:09:25 +0000 |
commit | 967812838c7e7742729a4c7aeb9859f98a509622 (patch) | |
tree | 22db2e6642be51cb12535db7863331457e5523c3 /lib | |
parent | 074d013e1eb3f6e0c27f96a3be8b9361254c8a98 (diff) | |
download | gitlab-ce-967812838c7e7742729a4c7aeb9859f98a509622.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/lfs_changes.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/http.rb | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/gitlab/git/lfs_changes.rb b/lib/gitlab/git/lfs_changes.rb index 8e2a925dfea..a0fab67e450 100644 --- a/lib/gitlab/git/lfs_changes.rb +++ b/lib/gitlab/git/lfs_changes.rb @@ -3,7 +3,7 @@ module Gitlab module Git class LfsChanges - def initialize(repository, newrev) + def initialize(repository, newrev = nil) @repository = repository @newrev = newrev end 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 |