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/models/error_tracking | |
parent | 56b82db63a91695a1dec1b7cbf39636bb01ad3df (diff) |
Catch exception in calculate reactive cache
Return the exception as an error.
Diffstat (limited to 'app/models/error_tracking')
-rw-r--r-- | app/models/error_tracking/project_error_tracking_setting.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/error_tracking/project_error_tracking_setting.rb b/app/models/error_tracking/project_error_tracking_setting.rb index 31084c54bdc..57283a78ea9 100644 --- a/app/models/error_tracking/project_error_tracking_setting.rb +++ b/app/models/error_tracking/project_error_tracking_setting.rb @@ -58,7 +58,7 @@ module ErrorTracking def list_sentry_issues(opts = {}) with_reactive_cache('list_issues', opts.stringify_keys) do |result| - { issues: result } + result end end @@ -69,8 +69,10 @@ module ErrorTracking def calculate_reactive_cache(request, opts) case request when 'list_issues' - sentry_client.list_issues(**opts.symbolize_keys) + { issues: sentry_client.list_issues(**opts.symbolize_keys) } end + rescue Sentry::Client::Error => e + { error: e.message } end # http://HOST/api/0/projects/ORG/PROJECT |