mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Avoid using exception but simply errors attribute contained in object
Co-Authored-By: Maikel <maikel@email.org.au>
This commit is contained in:
@@ -20,13 +20,12 @@ class InviteManagerReflex < ApplicationReflex
|
||||
return
|
||||
end
|
||||
|
||||
begin
|
||||
new_user = create_new_manager(email, enterprise)
|
||||
new_user = create_new_manager(email, enterprise)
|
||||
|
||||
if new_user.errors.empty?
|
||||
locals[:success] = true
|
||||
locals[:email] = new_user.email
|
||||
rescue StandardError => e
|
||||
@error = e.message
|
||||
locals[:error] = @error || I18n.t('admin.enterprises.invite_manager.error')
|
||||
else
|
||||
locals[:error] = new_user.errors.full_messages.to_sentence
|
||||
end
|
||||
|
||||
return_morph(locals)
|
||||
|
||||
Reference in New Issue
Block a user