Actuate JavaScript API classes : Class actuate.viewer.ViewerException

Class actuate.viewer.ViewerException

Description

A container for an exception. ViewerException provides an object to pass to a handler when the user-defined ON_EXCEPTION event occurs. It contains a reference to the element that generated the exception.

Constructor

The ViewerException object is constructed when an ON_EXCEPTION event occurs. The exceptions are divided into three types, which determine the contents of the exception object. These types are:

n  
n  
n  

Function summary

Table 4-49 lists actuate.viewer.ViewerException functions.

actuate.viewer.ViewerException.getDescription

Syntax

string ViewerException.getDescription( )

Returns exception details as provided the Server, Client, and User objects.

Returns

String. A detailed description of the error. Information is provided according to the type of exception generated, as shown below:

n  
n  
n  

actuate.viewer.ViewerException.getElement

Syntax

object ViewerException.getElement( )

Returns an instance of the element that caused the exception, if applicable. The instance can be an object of one of following types:

n  
n  
n  
n  
n  

To determine the object type, use the Object.getType( ) function. The type strings for the above objects are "Chart", "Data", "Label", "Table", or "Text" respectively.

Returns

Object. An instance of the element that generated the exception.

actuate.viewer.ViewerException.getErrCode

Syntax

string Exception.getErrCode( )

Returns the error code for Server exceptions.

Returns

String. A server error code.

Example

This example displays the server error code in an alert box.

alert("Server error code: " + ViewerException.getErrCode( ));

actuate.viewer.ViewerException.getMessage

Syntax

string ViewerException.getMessage( )

Returns a short message about the exception. This message is set for an actuate.Exception object with the actuate.Exception.initJSException( ) function.

Returns

String. A short message.

Example

This example displays the error’s short message code in an alert box.

alert("Error Message: " + ViewerException.getMessage( ));

actuate.viewer.ViewerException.getType

Syntax

string ViewerException.getType( )

Returns the type of the exception:

n  
n  
n  

Returns

String. A server error code.

Example

This example displays the error type in an alert box.

alert("Error type: " + ViewerException.getType( ));

actuate.viewer.ViewerException.isExceptionType

Syntax

boolean ViewerException.isExceptionType(object exceptionType)

Compares the input object to the exception contained in this actuate.Exception object to the exceptionType object argument.

Parameters

exceptionType

Object. Either an exception object, such as an instance of actuate.Viewer.ViewerException, or the name of an exception class as a string.

Returns

Boolean. Returns True if the exception contained in this actuate.Exception object matches the exceptionType object argument.

Example

To alert the user when the exception e is a usage error, use code similar to the following:

if (e.isExceptionType(actuate.viewer.ViewerException.ERR_USAGE)){
  alert('Usage error occurred!');
}

 


(c) Copyright Actuate Corporation 2011