/
Error Handling

Error Handling

The Error Handling module establishes methods for logging and handling errors that occur in experience designer code.

Dependencies

The Error Handling module is dependent on the following modules:

The Error Type Schema

The Error Type schema is a global dynamic schema used to configure and track occurrence counts for a particular error type. It has the following fields:

  • threshold (number): If there are more than this number of occurrences of this error type in a day, a notification email will be triggered.

  • emails (string, comma separated): A comma separated list of emails to send a notification email to if the threshold is exceeded.

  • count (number): The current count of occurrences of this error type today.

  • sendSupportEmails (boolean): Whether or not to send an email to Orbita support the first time an error crosses the notification threshold.

sendSupportEmails is automatically set to true when a new Error Type is created on production environments. threshold is automatically set to 1 in this case if no defaultThreshold setting has been set.

The Error Schema

The Error schema is a global dynamic schema used to record details about a particular occurrence of an error.

  • sessionID (string): The ID of the session during which the error occurred.

  • timestamp (date): The date and time when the error occurred.

  • type (string): The type of the error.

  • message (string): The error message, if any.

  • source (string): The name, type, and ID of the node in experience designer that the error originated from.

Methods

logError

Logs an error in the console and creates an Error record. Will also create a new Error Type record if the error type has not been configured before, and will send a notification email when appropriate.

Parameters:

  • type (string): The type of the error.

  • msg (string): The Node-RED message object.

  • message (string): An explicit error message to record (will supersede any message in msg.error).

Returns: Nothing.

unhandledErrorResponse

Attempts to handle an unhandled error (based on context) to display the default error message to the user:

  • If the msg object contains an “alexaResponse” property, it will attempt to respond using a say node and response node.

  • Otherwise, if the request appears to be a v3 chatbot request, it will form an appropriate payload and response via a v3 Bot OUT node.

  • Otherwise, if the request appears to be a v2 chatbot request, it will respond with a payload appropriate for that context.

  • Otherwise it will return a generic JSON error object.

Parameters:

  • msg (string): The Node-RED message object.

Returns: Nothing.

Settings

Settings specific to the Error Handling module are specified under settings.errorHandling:

  • defaultMessage: The default error message to use when handling unhandled exceptions

  • defaultEmails: The default notification emails to use when creating a new Error Type record

  • defaultThreshold: The default threshold value to use when creating a new Error Type record

For example:

"errorHandling": { "defaultMessage": "I'm sorry, an unexpected error has occurred. Please try again later.", "defaultEmails": [ "andrew.merola@orbita.ai", "mark.cline@orbita.ai", "jason.masterson@orbita.ai" ], "defaultThreshold": 5 }

Error Count Reset

The module includes a scheduled process that runs at 4:00 AM GMT every day to reset the current count in each Error Type record to 0.