Return different responses for use case errors
This commit is contained in:
parent
22a66f4d1a
commit
1216c249e8
|
@ -20,6 +20,18 @@ class AjaxController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
rescue_from(Errors::Base) do |e|
|
||||
Sentry.capture_exception(e)
|
||||
|
||||
@response = {
|
||||
success: false,
|
||||
message: e.message,
|
||||
status: e.code
|
||||
}
|
||||
|
||||
return_response
|
||||
end
|
||||
|
||||
rescue_from(KeyError) do |e|
|
||||
Sentry.capture_exception(e)
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "use_case/base"
|
||||
require "errors"
|
||||
|
||||
module UseCase
|
||||
module Question
|
||||
|
|
Loading…
Reference in New Issue