GenericException

This JavaScript method provides generic exception wrapping.

Where to use

Use these methods to define exception handling in your JavaScript code.

Method summary

Method summary Description
initialize(errorMessage) Method called by the Prototype JavaScript Framework during object creation.
getMessage() Gets the error message.
toString() Converts the error message to a string.

Method detail

initialize(errorMessage)
Called by the Prototype JavaScript Framework during object creation to initialize a new instance of this class. Provide the parameter value but do not directly call this method.
  • Input field parameters: errorMessage: (string) the error message.
  • Output field returns: void.

Example that returns void:

var jerr = new  GenericException("This is an error");
getMessage()
Gets the error message.
  • Input field parameter: none
  • Output field returns: (string) the error message.

Example:

var jerr = new  GenericException("This is an error");
gs.print(jerr.getMessage());

Returns the output: *** Script: This is an error

toString()
Converts the error message to a string.
  • Input field parameter: none
  • Output field returns: (string) the error message.

Example:

var jerr = new  GenericException("This is an error");
gs.print(jerr.toString());

Returns the output: *** Script: This is an error