Use generic handling of our own exceptions

Noticed that we shouldn't be trying to catch specific exceptions as `Dry::Types` will throw its own exceptions for validation errors.
This commit is contained in:
Karina Kwiatek 2022-01-19 19:57:51 +01:00 committed by Karina Kwiatek
parent 29d46b43db
commit 677ce26e6c
1 changed files with 4 additions and 4 deletions

View File

@ -17,8 +17,8 @@ class Ajax::RelationshipController < AjaxController
) )
@response[:success] = true @response[:success] = true
@response[:message] = t("messages.friend.create.okay") @response[:message] = t("messages.friend.create.okay")
rescue Errors::Base rescue Errors::Base => e
@response[:message] = t("messages.answer.create.fail") @response[:message] = t(e.locale_tag)
ensure ensure
return_response return_response
end end
@ -31,8 +31,8 @@ class Ajax::RelationshipController < AjaxController
) )
@response[:success] = true @response[:success] = true
@response[:message] = t("messages.friend.destroy.okay") @response[:message] = t("messages.friend.destroy.okay")
rescue Errors::Base rescue Errors::Base => e
@response[:message] = t("messages.friend.destroy.fail") @response[:message] = t(e.locale_tag)
ensure ensure
return_response return_response
end end