ng-token-auth
ng-token-auth copied to clipboard
Duplicate Email during update - get error message instead of stack trace
How to get an error message when email update fails because it exists already?
Currently, it throws exception and I cant figure out where to rescue to return an error message to the client. The error message looks like 👍
PG::UniqueViolation at /auth
============================
> ERROR: duplicate key value violates unique constraint "index_users_on_uid_and_provider"
DETAIL: Key (uid, provider)=([email protected], email) already exists.
activerecord (4.2.1) lib/active_record/connection_adapters/postgresql_adapter.rb, line 602
------------------------------------------------------------------------------------------
...
...