The JavaScript errors are handled by adding JavaScript functions to your application and registering them as error handler functions.

Error Handler Function

Write your error handling business logic in the JavaScript function which has to have the following signature:

function <ErrorHandlerFunctionName>( event, exception [, errorCode] [, origin] )

The arguments are:

event: identifies the jQuery event;

exception: is the JavaScript exception instance that raised the error. For more details about the error use the and exception.message properties;

errorCode: an integer that identifies the type of error. This argument is optional;

origin: the JavaScript function where the error was trapped. This argument is optional.

By default, the OutSystems Platform provides you a basic error handler function called OsAlertExceptionHandler which displays an alert box with information about the error.

Predefined Error Codes

When implementing the error handling business logic in your function you may use the OutSystems Platform predefined error codes:

Register an Error Handler Function

To set your JavaScript function for error handling you must register it. For that, add the following JavaScript to your application:


You may register multiple functions to handle errors. All the registered error handler functions are executed when a JavaScript error occurs.

See also

Adding JavaScript