diff options
author | Reuben Pereira <rpereira@gitlab.com> | 2019-03-29 14:53:40 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-03-29 14:53:40 +0000 |
commit | c558d72b5bca44984c32b6f65f4b56332ee828f6 (patch) | |
tree | 7d03939699cb6915f2c6e00aaa53f0e25df1b0c2 /app/models/error_tracking | |
parent | bf48b071f9c19c6585eb3e589bb8bc2ab6a75723 (diff) | |
download | gitlab-ce-c558d72b5bca44984c32b6f65f4b56332ee828f6.tar.gz |
Handle missing keys in sentry api response
- Do not raise error when there are missing non-essential keys in sentry
api response.
- Add specs for to check for missing keys behavior.
Diffstat (limited to 'app/models/error_tracking')
-rw-r--r-- | app/models/error_tracking/project_error_tracking_setting.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/error_tracking/project_error_tracking_setting.rb b/app/models/error_tracking/project_error_tracking_setting.rb index 8edc04cc268..70954bf8b05 100644 --- a/app/models/error_tracking/project_error_tracking_setting.rb +++ b/app/models/error_tracking/project_error_tracking_setting.rb @@ -5,6 +5,9 @@ module ErrorTracking include Gitlab::Utils::StrongMemoize include ReactiveCaching + SENTRY_API_ERROR_TYPE_MISSING_KEYS = 'missing_keys_in_sentry_response' + SENTRY_API_ERROR_TYPE_NON_20X_RESPONSE = 'non_20x_response_from_sentry' + API_URL_PATH_REGEXP = %r{ \A (?<prefix>/api/0/projects/+) @@ -90,7 +93,9 @@ module ErrorTracking { issues: sentry_client.list_issues(**opts.symbolize_keys) } end rescue Sentry::Client::Error => e - { error: e.message } + { error: e.message, error_type: SENTRY_API_ERROR_TYPE_NON_20X_RESPONSE } + rescue Sentry::Client::MissingKeysError => e + { error: e.message, error_type: SENTRY_API_ERROR_TYPE_MISSING_KEYS } end # http://HOST/api/0/projects/ORG/PROJECT |