Custom Database Error Handling and Troubleshooting
In this article, we will show you how you can 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
There are three different errors you can return from a database connection:
||an error that occurs when you know who the user is and want to keep track of a wrong password being used|
||a generic error with an error code|
||a simple error (no error code included)|
To return an error, call the callback function while passing error as the first parameter:
callback(new ValidationError('email-too-long', 'Email is too long.'));
Returning errors when using Lock
Test the script using the TRY button. If your settings are correct you should see the resulting profile:
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.