Custom errors
When a user action encounters an error, a generic message, such as “The action failed to execute,” is displayed. This message, while informative, may not provide users with enough context or guidance. To improve the user experience, you can throw a custom error message that is more specific to the situation.
Creating a custom error
To override the default error message, you can throw a CustomError with a tailored message, providing additional clarity for the user:
throw new CustomError("Custom error message");
Text expressions in custom errors
You can make custom error messages dynamic and more user-specific by embedding data using Text Expressions. This approach allows you to personalize error messages based on variables or context from within the application:
throw new CustomError("Hello {{F['clientName']}}! An error was thrown.");