Skip to main content

Extensibility and Integration



Add a Custom Error Message to an Exposed REST API

When a REST API method runs into an error, it's useful to send a meaningful error message to the client about what happened. Some of the problems are automatically handled for you by the OutSystems, but you have the possibility to add custom error handling to your logic.

OutSystems will automatically handle the following errors:

  • Invalid requests;
  • Unhandled exceptions during the execution of the REST API method’s action flow. 

If you want to add a custom error that appears in the response body, do the following:

  1. Create a new User Exception;
  2. Raise the user exception in your REST API method:
    1. Add a Raise Error element to the action flow of the REST API method;
    2. In the Exception property, set it to raise the User Exception you have created in 1;
    3. Set the Exception Message property to your custom error message.


  • Was this article helpful?