diff options
author | Reuben Pereira <rpereira@gitlab.com> | 2019-02-21 14:19:51 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-02-21 14:19:51 +0300 |
commit | 536463295c2598505135bc61570ea66e1bad6496 (patch) | |
tree | 4bb61e295d682140d3c0cf8d9c3923e49e9e8e2b /app/services | |
parent | 56b82db63a91695a1dec1b7cbf39636bb01ad3df (diff) |
Catch exception in calculate reactive cache
Return the exception as an error.
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/error_tracking/list_issues_service.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/services/error_tracking/list_issues_service.rb b/app/services/error_tracking/list_issues_service.rb index 4cc35cfa4a8..a6c6bec9598 100644 --- a/app/services/error_tracking/list_issues_service.rb +++ b/app/services/error_tracking/list_issues_service.rb @@ -6,15 +6,19 @@ module ErrorTracking DEFAULT_LIMIT = 20 def execute - return error('not enabled') unless enabled? - return error('access denied') unless can_read? + return error('Error Tracking is not enabled') unless enabled? + return error('Access denied', :unauthorized) unless can_read? result = project_error_tracking_setting .list_sentry_issues(issue_status: issue_status, limit: limit) # our results are not yet ready unless result - return error('not ready', :no_content) + return error('Not ready. Try again later', :no_content) + end + + if result[:error].present? + return error(result[:error], :bad_request) end success(issues: result[:issues]) |