Troubleshoot Custom Databases
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.
Types of errors
You may receive different types of errors from a database connection:
||Login||Occurs when the user's credentials are invalid. Passing no arguments or a falsey first argument will result in the error being logged as an
||Create||Occurs when a user already exists in your database.|
||Change Password||Occurs when the user's password was not updated.|
||Get User||Occurs when the user is not found.|
||All Login Scripts||Occurs when something went wrong while trying to reach the database. Preferred way of communicating errors back from custom databases to front-end.|
||All Login Scripts||Occurs when something went wrong while trying to reach the database.|
||Create||Occurs in legacy identity store when you attempt to create a user that already exists in your legacy identity store or in Auth0.|
||Delete||Occurs in legacy identity store when you attempt to delete a user with custom database scripts. Error could also manifest as
To return an error, call the callback function while passing error as the first parameter:
Was this helpful?
callback(new ValidationError('email-too-long', 'Email is too long.'));
Was this helpful?
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.
Test the script using the Try button.
If you do not get the expected result or you receive an error, install the Real-time Webtask Logs extension, use
console.log() statements in your script, and try the connection again. The output of
console.log() will print to the Real-time Webtask Logs window.
You may experience errors using action scripts to import, create, or delete users. Use
console.logs to verify the error is a result of using action scripts. To learn more, read Custom Database Action Script Templates.