Name

Class xbException — Provide an wrapper for Javascript Exceptions

Synopsis

extends Class xbObject

class xbException : xbObject
{
  // constructor
  xbException(String errorMessage, 
              String errorFile, 
              String errorFunction, 
              Object nativeException = null);
   
  // properties
  String errorMessage;
  String errorFile;
  String errorFunction;
  String nativeMessage
  Variant nativeException
}
		

Example

// throw a 'pure' xbException
throw( new xbException('message', 'file', 'function'));
		
// throw a 'wrapper' xbException 
var error;

try
{ 
   // some code
}
catch(error)
{
   throw( new xbException('message', 'file', 'function', error));
}

Description

xbException is meant as a portable Exception/Error class. IE's and Mozilla's implementations of Error Exceptions, etc differ in terms of properties making it difficult to handle exceptions. xbException is meant to be constructed either as a standalone 'pure' exception or as an exception wrapper for the native exceptions thrown by the browser.

Properties

errorMessage

readonly String - a description of the error.

errorFile

readonly String - name of file where the error occurred.

errorFunction

readonly String - name of function where the error occurred.

nativeMessage

readonly String - error message constructed from the native exception's properties.

nativeException

readonly Object - reference to the native exception if any.

Methods

xbException(String errorMessage, String errorFile, String errorFunction, Object nativeException = null)

Constructs an instance of the xbException class.

If nativeException is already a xbException, i.e nativeException.isa == 'xbException' then the new xbException is a clone of nativeException ignoring the errorMessage, errorFile, errorFunction parameters. This allows a 'wrapper' xbException to be thrown and then propagated up through a chain of xbException's all the while keeping the original error information.

If nativeException is not already a xbException, the xbException is constructed from the input parameters.

Returns. nothing

Exceptions

  • None