onerror



This config property can be set to a custom function, which adds extra processing for all application runtime errors. The function can be used to provide additional notifications, such as emails or text messages to admin staff, when errors occur.

The function receives an information object parameter about the error. The object will have the following properties:

  • error - the JavaScript Error object

  • messageId - the error id

  • message - the error message

  • func - the function name where the error occurred

  • file - the JavaScript source code file name where the error ocurred

  • line - the line number where the error occurred

  • column - the line's column number where the error occurred

  • severity - the error's severity

  • stack - the error stack or a trace of which functions were called prior to the error

  • prettyLine - the actual line of source code formatted as HTML, with the error highlighted

  • prettyStack - the error stack formatted as HTML

  • errscrnData - screen data for the Profound UI Error Screen located in the puiscreens.json file

  • sessionId - the persistent Profound.js session id

  • user - IBM i user id (if applicable)

  • jobName - IBM i job name (if applicable)

  • jobNumber - IBM i job number (if applicable)

Example

onerror: function(errInfo) { var sendMessage = require("./sendTextToAdmin.js"); // This can be any custom API to send email or text messages to your admin staff sendMessage("An error occurred in " + errorInfo.file + ": " + errInfo.message); }



Click here for information on how to modify this setting.