Customizing error messages

You might want to create customized error messages that will give your users more clarity about the error. In order to do that, you can use throw new Error code and customize the message text.

Use case

Let's say you would like to throw an error that doesn't allow editing a row in a table on a certain condition. Here's how to do that:

  1. Add the code that will throw an error on a required condition: Code action type - specify the code, e.g.:

if (!{{state.allowRowEdit}}) {
    throw new Error ('Row editing is not allowed')
}

If you are using one of the predefined actions (Load Table, Create Row, etc.), then create a multistep action with a code step as a first, and a predefined action as a second step:

2. In the Config section of the action, navigate the Error toast, and refer to the error message as {{actions.yourAction.error.message}}:

Now, anytime the condition is met and the action fails, the user will see a customized error message.

Last updated