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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-12 03:06:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-12 03:06:21 +0300
commit75687c79df805b57914d79cf217e3f08dbc77cc2 (patch)
treebff07aefc6467b8a7e00cd7649109fc6e8b7768f /lib/sentry/client.rb
parent0c3f12149372a79b825d265a6c28dc547e4a1afc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/sentry/client.rb')
-rw-r--r--lib/sentry/client.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/sentry/client.rb b/lib/sentry/client.rb
index f16df0dde4f..15158bbc3b5 100644
--- a/lib/sentry/client.rb
+++ b/lib/sentry/client.rb
@@ -4,6 +4,7 @@ module Sentry
class Client
Error = Class.new(StandardError)
MissingKeysError = Class.new(StandardError)
+ ResponseInvalidSizeError = Class.new(StandardError)
attr_accessor :url, :token
@@ -27,6 +28,8 @@ module Sentry
def list_issues(issue_status:, limit:)
issues = get_issues(issue_status: issue_status, limit: limit)
+ validate_size(issues)
+
handle_mapping_exceptions do
map_to_errors(issues)
end
@@ -42,6 +45,16 @@ module Sentry
private
+ def validate_size(issues)
+ return if Gitlab::Utils::DeepSize.new(issues).valid?
+
+ raise Client::ResponseInvalidSizeError, "Sentry API response is too big. Limit is #{Gitlab::Utils::DeepSize.human_default_max_size}."
+ end
+
+ def valid_size?(issues)
+ Gitlab::Utils::DeepSize.new(issues).valid?
+ end
+
def handle_mapping_exceptions(&block)
yield
rescue KeyError => e
@@ -108,7 +121,7 @@ module Sentry
raise_error "Sentry response status code: #{response.code}"
end
- response
+ response.parsed_response
end
def raise_error(message)