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:
Karina Kwiatek 2022-06-11 23:15:24 +02:00 committed by Karina Kwiatek
parent 65309edd8f
commit febbee1306
1 changed files with 5 additions and 14 deletions

View File

@ -32,20 +32,11 @@ class Ajax::AnswerController < AjaxController
return
end
answer = nil
begin
answer = if inbox
inbox_entry.answer params[:answer], current_user
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.each do |service|