Docs

Custom Database Error Handling and Troubleshooting

You can use return errors resulting from your custom database connection for troubleshooting purposes. We will also cover some basic troubleshooting steps for your scripts.

Configure Auth0

Types of errors

There are three different errors you can return from a database connection:

Error Description
new WrongUsernameOrPasswordError(<email or user_id>, <message>) an error that occurs when you know who the user is and want to keep track of a wrong password being used
new ValidationError(<error code>, <message>) a generic error with an error code
new Error(<message>) a simple error (no error code included)

Get Your Application Keys

Return errors

To return an error, call the callback function while passing error as the first parameter:

Example:

Configure Callback URLs

Returning errors when using Lock

If you use Lock, you can customize the error messages that will be displayed by adding them to the dictionary.

Configure Logout URLs

Troubleshooting Errors

Test the script using the TRY button.

If you do not get the expected result, or you receive an error, use console.logstatements in your script and try the connection again. The output of console.log prints in the try the script window.