Please enable JavaScript to view this site.

Process Designer

Navigation: Javascript API > General

Error handling

Scroll Prev Top Next More

Error handling in customized JavaScript functions

A JobRouterException object is available that can be thrown in all JavaScript functions.

Example:

try {

  throw new JobRouterException('This is a JobRouterException message');

} catch(e) {

  console.log(e.message);

}

Individual error handling for JavaScript API

For API functions, which can be used for the individual error handling of occurring errors, a function can now be passed as a last parameter. The alerts in the JavaScript API functions were replaced by JobRouterExceptions.

Example:

function myCustomErrorHandler(message) {

  console.log(message);

}

 

var result = jr_get_value('my_element', myCustomErrorHandler);

For API functions such as jr_loop_table one or more callback function(s) can be passed, the function for the error handling is passed after the callback function(s).

Example:

function myCustomErrorHandler(message) {

  console.log(message);

}

 

function myCallbackFunction(subtable, rowId) {

  jr_get_subtable_value(subtable, rowId, 'SPALTE1');

}

 

jr_loop_table('Subtable1', myCallbackFunction, myCustomErrorHandler);