In order to have descriptive error messages and codes on the server we use a generic error named
AccountsJsError. This error provide a
message property containing a descriptive error message (eg: "Email already exists"). It also provides a
code property that is reflecting a constant value to the error (eg:
Every public server function is exporting a custom enum describing all the possible errors.
You can catch errors and do some custom logic based on the error like this: