diff options
author | Reuben Pereira <rpereira@gitlab.com> | 2019-03-29 17:53:40 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-03-29 17:53:40 +0300 |
commit | c558d72b5bca44984c32b6f65f4b56332ee828f6 (patch) | |
tree | 7d03939699cb6915f2c6e00aaa53f0e25df1b0c2 /app/services/error_tracking/list_issues_service.rb | |
parent | bf48b071f9c19c6585eb3e589bb8bc2ab6a75723 (diff) |
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/services/error_tracking/list_issues_service.rb')
-rw-r--r-- | app/services/error_tracking/list_issues_service.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/services/error_tracking/list_issues_service.rb b/app/services/error_tracking/list_issues_service.rb index a6c6bec9598..86ab21fa865 100644 --- a/app/services/error_tracking/list_issues_service.rb +++ b/app/services/error_tracking/list_issues_service.rb @@ -18,7 +18,7 @@ module ErrorTracking end if result[:error].present? - return error(result[:error], :bad_request) + return error(result[:error], http_status_from_error_type(result[:error_type])) end success(issues: result[:issues]) @@ -30,6 +30,15 @@ module ErrorTracking private + def http_status_from_error_type(error_type) + case error_type + when ErrorTracking::ProjectErrorTrackingSetting::SENTRY_API_ERROR_TYPE_MISSING_KEYS + :internal_server_error + else + :bad_request + end + end + def project_error_tracking_setting project.error_tracking_setting end |