OverviewSingleDeprecated

jsx3.lang

class NativeError

Object
->jsx3.lang.Object
  ->jsx3.lang.Exception
    ->jsx3.lang.NativeError

class NativeError
extends jsx3.lang.Exception
Wraps the browser-native exception object (what might be caught in a typical try/catch/finally block).

The following sample code shows how to use try/catch blocks in JavaScript and ensure that a caught exception is always an instance of jsx3.lang.Exception:
try {
  tryIt(); // code that may throw a native error (null-pointer, etc)
           // or an instance of jsx3.Exception
} catch (e) {
  e = jsx3.NativeError.wrap(e);
  // now e is guaranteed to be an instance of jsx3.Exception
  window.alert(e.printStackTrace());
}

Since:

3.1

Constructor Summary
void
init(objError : Object)
The instance initializer.
Method Summary
String
Returns the URL of the JavaScript include where this error was raised.
int
Returns the line number in the JavaScript include where this error was raised.
String
Returns the native message for this error.
String
Returns the native browser name for this error.
static void
Initializes the error trapping mechanism.
boolean
Deprecated.
String
Returns the native error as a human-readable string.
static jsx3.lang.Exception
Wraps a native browser exception in an instance of NativeError.
Methods Inherited From jsx3.lang.Exception
getCause, getStack, printStackTrace
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf
Constructor Detail

init

void init(objError : Object)
The instance initializer.

Parameters:

objErrorbrowser-native exception object (what would be thrown by a try/catch block)

Throws:

{jsx3.lang.IllegalArgumentException}if objException is not a native browser error. Use NativeError.wrap() if the type of caught object is unknown.

See Also:

wrap()
Method Detail

getFileName

String getFileName()
Returns the URL of the JavaScript include where this error was raised.

Returns:

 

getLineNumber

int getLineNumber()
Returns the line number in the JavaScript include where this error was raised.

Returns:

 

getMessage

String getMessage()
Returns the native message for this error.

Returns:

 

Overrides:

getMessage in jsx3.lang.Exception

getName

String getName()
Returns the native browser name for this error.

Returns:

 

initErrorCapture

static void initErrorCapture(fctTrap : Function)
Initializes the error trapping mechanism. Once this methor is called, all uncaught exceptions will be routed through this class to the logging system.

Parameters:

fctTrap

isStructural

boolean isStructural()
Deprecated.
Returns true if this error was due to poorly-formatted JavaScript (lexical/structural as opposed to logical).

Returns:

 

toString

String toString()
Returns the native error as a human-readable string.

Returns:

 

Overrides:

toString in jsx3.lang.Exception

wrap

static jsx3.lang.Exception wrap(objError : jsx3.lang.Exception | Object)
Wraps a native browser exception in an instance of NativeError. This method also accepts an argument of type jsx3.Exception, in which case it will just return the argument. This method wraps any other type of argument by converting it to a string and and creating a new jsx3.Exception with that message.

Parameters:

objError

Returns: