diff options
Diffstat (limited to 'app/services/error_tracking/list_projects_service.rb')
-rw-r--r-- | app/services/error_tracking/list_projects_service.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/app/services/error_tracking/list_projects_service.rb b/app/services/error_tracking/list_projects_service.rb index c6e8be0f2be..f2d0904a41f 100644 --- a/app/services/error_tracking/list_projects_service.rb +++ b/app/services/error_tracking/list_projects_service.rb @@ -11,12 +11,15 @@ module ErrorTracking return error(setting.errors.full_messages.join(', '), :bad_request) end - begin - result = setting.list_sentry_projects - rescue Sentry::Client::Error => e - return error(e.message, :bad_request) - rescue Sentry::Client::SentryError => e - return error(e.message, :unprocessable_entity) + result = setting.list_sentry_projects + + # our results are not yet ready + if result.nil? + return error('not ready', :no_content) + end + + if result[:error].present? + return error(result[:error], result[:http_status] || :bad_request) end success(projects: result[:projects]) |