<
Last update Fri Apr 28 11:05:24 2006
std
 std.array
 std.atomic
 std.bitarray
 std.exception
 std.intrinsic
 std.memory
 std.regexp
 std.thread
 std.traits
 std.unicode
 std.vararg
 std.math.core
 std.math.ieee
 std.math.special

std.exception

The exception module defines all system-level exceptions and provides a mechanism to alter system-lever error handling.

Design Issues:

The Exception base class is required to live in the global object module, as it is used by the system for exception propogation.

Future Directions:

It may be useful to provide a means of determining whether an exception is currently in flight. This would require cooperation with the thread module to implement.

class ArrayBoundsException: object.Exception;
Thrown on an array bounds error.

class AssertException: object.Exception;
Thrown on an assert error.

class FinalizeException: object.Exception;
Thrown on finalize error.

class OutOfMemoryException: object.Exception;
Thrown on an out of memory error.

class SwitchException: object.Exception;
Thrown on a switch error.

class UnicodeException: object.Exception;
Thrown on a unicode conversion error.

void setAssertHandler(void(* h)(char[] file, uint line, char[] msg = null));
Overrides the default assert hander with a user-supplied version.

Params:
void(* h)(char[] file, uint line, char[] msg = null) The new assert handler.

void setCollectHandler(bool(* h)(Object obj));
Overrides the default collect hander with a user-supplied version.

Params:
bool(* h)(Object obj) The new collect handler.

void onAssertError(char[] file, uint line);
A callback for assert errors in D. The user-supplied assert handler will be called if one has been supplied, otherwise an AssertException will be thrown.

Params:
char[] file The name of the file that signaled this error.
uint line The line number on which this error occurred.
msg An error message supplied by the user.

void onAssertErrorMsg(char[] file, uint line, char[] msg);
A callback for assert errors in D. The user-supplied assert handler will be called if one has been supplied, otherwise an AssertException will be thrown.

Params:
char[] file The name of the file that signaled this error.
uint line The line number on which this error occurred.

bool onCollectResource(Object obj);
This function will be called when resource objects (ie. objects with a dtor) are finalized by the garbage collector. The user-supplied collect handler will be called if one has been supplied, otherwise no action will be taken.

Params:
Object obj The object being collected.

Returns:
true if the runtime should call this object's dtors and false if not. Default behavior is to return true.

void onArrayBoundsError(char[] file, uint line);
A callback for array bounds errors in D. An ArrayBoundsException will be thrown.

Params:
char[] file The name of the file that signaled this error.
uint line The line number on which this error occurred.

Throws:
ArrayBoundsException.

void onFinalizeError(ClassInfo info, Exception ex);
A callback for finalize errors in D. A FinalizeException will be thrown.

Params:
e The exception thrown during finalization.

Throws:
FinalizeException.

void onOutOfMemoryError();
A callback for out of memory errors in D. An OutOfMemoryException will be thrown.

Throws:
OutOfMemoryException.

void onSwitchError(char[] file, uint line);
A callback for switch errors in D. A SwitchException will be thrown.

Params:
char[] file The name of the file that signaled this error.
uint line The line number on which this error occurred.

Throws:
SwitchException.

void onUnicodeError(char[] msg, uint idx);
A callback for unicode errors in D. A UnicodeException will be thrown.

Params:
char[] msg Information about the error.
uint idx String index where this error was detected.

Throws:
UnicodeException.