Display Error Messages Returned from Custom Databases with New Universal Login
Last Updated:
Overview
This article provides instructions on how to display error messages that are returned from custom database scripts to the user during the login flow with New Universal Login.
Applies To
- Custom Database scripts
- New Universal Login
Solution
Use the UnauthorizedError function within custom database scripts to send error messages to the front-end for the user to view. This is the recommended method to communicate errors from custom databases.
To implement the error message, follow these steps:
-
Locate the callback function within the custom database script.
-
Use the
new UnauthorizedError(<message>)constructor inside the callback. -
Enter the specific error message text within the angle brackets to be displayed to the user.
For additional information on handling errors, refer to the Error Handling documentation.