Simplify error handling in answer create method
We were previously catching all exceptions when creating the answer and returning a generic error. As exception handling is done in `AjaxController`, we don't need to do this and can get more specific error messages instead.
This commit is contained in:
parent
65309edd8f
commit
febbee1306
|
@ -32,20 +32,11 @@ class Ajax::AnswerController < AjaxController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
answer = nil
|
|
||||||
|
|
||||||
begin
|
|
||||||
answer = if inbox
|
answer = if inbox
|
||||||
inbox_entry.answer params[:answer], current_user
|
inbox_entry.answer params[:answer], current_user
|
||||||
else
|
else
|
||||||
current_user.answer question, params[:answer]
|
current_user.answer question, params[:answer]
|
||||||
end
|
end
|
||||||
rescue => e
|
|
||||||
Sentry.capture_exception(e)
|
|
||||||
@response[:status] = :err
|
|
||||||
@response[:message] = I18n.t('messages.error')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
services = JSON.parse params[:share]
|
services = JSON.parse params[:share]
|
||||||
services.each do |service|
|
services.each do |service|
|
||||||
|
|
Loading…
Reference in New Issue