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
|
answer = if inbox
|
||||||
|
inbox_entry.answer params[:answer], current_user
|
||||||
begin
|
else
|
||||||
answer = if inbox
|
current_user.answer question, params[:answer]
|
||||||
inbox_entry.answer params[:answer], current_user
|
end
|
||||||
else
|
|
||||||
current_user.answer question, params[:answer]
|
|
||||||
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