Error

Error objects are dynamically created whenever an exception is thrown from methods or properties implemented in JavaScript. Several subclasses of the Error object can be thrown by core JavaScript (EvalError, RangeError, SyntaxError, TypeError, ReferenceError, URLError). They all have the Error object as prototype. JavaScript can throw some of these exceptions, or implement subclasses of the Error object at its convenience. If your scripts are using the mechanism of try/catch error handling, the object thrown should be one of the types listed in the following table.

Error object

Brief description

RangeError 

Argument value is out of valid range.

TypeError 

Wrong type of argument value.

ReferenceError 

Reading a variable that does not exist.

MissingArgError 

Missing required argument.

NumberOfArgsError 

Invalid number of arguments to a method.

InvalidSetError 

A property set is not valid or possible.

InvalidGetError 

A property get is not valid or possible.

OutOfMemoryError 

Out of memory condition occurred.

NotSupportedError 

Functionality not supported in this configuration (for example, Adobe Reader).

NotSupportedHFTError 

HFT is not available (a plug-in may be missing).

NotAllowedError 

Method or property is not allowed for security reasons.

GeneralError 

Unspecified error cause.

RaiseError 

Acrobat internal error.

DeadObjectError 

Object is dead.

HelpError 

User requested for help with a method.

Error object types implemented by JavaScript inherit properties and methods from the core Error object. Some JavaScript objects may implement their own specific types of exception. A description of the Error subclass (with added methods and properties, if any) should be provided in the documentation for the particular object.

Example

Print all properties of the Error object to the console.

   try {

      app.alert(); // one argument is required for alert

   } catch(e) {

      for (var i in e)

      console.println( i + ": " + e[i])

   }