Files
chatwoot/lib/custom_exceptions/account.rb
Shivam Mishra 07ea9694a3 feat: new accounts controller for signup+onboarding (#8804)
* feat: add v2 accounts controller

* feat: allow empty account and user name

* feat: ensure  and  is present for v1 signup

* test: remove validation checks

* chore: apply suggestions

* chore: revert en.yml formatting

* chore: line at EOF

* fix: routes

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2024-02-02 16:10:45 +05:30

44 lines
940 B
Ruby

# frozen_string_literal: true
module CustomExceptions::Account
class InvalidEmail < CustomExceptions::Base
def message
if @data[:disposable]
I18n.t 'errors.signup.disposable_email'
elsif !@data[:valid]
I18n.t 'errors.signup.invalid_email'
end
end
end
class UserExists < CustomExceptions::Base
def message
I18n.t('errors.signup.email_already_exists', email: @data[:email])
end
end
class InvalidParams < CustomExceptions::Base
def message
I18n.t 'errors.signup.invalid_params'
end
end
class UserErrors < CustomExceptions::Base
def message
@data[:errors].full_messages.join(',')
end
end
class SignupFailed < CustomExceptions::Base
def message
I18n.t 'errors.signup.failed'
end
end
class PlanUpgradeRequired < CustomExceptions::Base
def message
I18n.t 'errors.plan_upgrade_required.failed'
end
end
end