core.exception
The exception module defines all system-level exceptions and provides a mechanism to alter system-level error handling.
Copyright
Copyright Sean Kelly 2005 - 2013.
alias AssertHandler
class ArrayIndexError ArraySliceError AssertError FinalizeError ForkError InvalidMemoryOperationError OutOfMemoryError RangeError SuppressTraceInfo SwitchError UnicodeException
fn __switch_errorT _d_arraybounds _d_arraybounds_index _d_arraybounds_indexp _d_arraybounds_slice _d_arraybounds_slicep _d_arrayboundsp _d_assert _d_assert_msg _d_assertp _d_unittest _d_unittest_msg _d_unittestp assertHandler onArrayIndexError onArraySliceError onAssertError onAssertErrorMsg onFinalizeError onForkError onInvalidMemoryOperationError onRangeError onUnicodeError onUnittestErrorMsg staticError
Types 12
classRangeError : Error
classArrayIndexError : RangeError
Thrown when an out of bounds array index is accessed.
Fields
size_t indexIndex into arraysize_t lengthLength of indexed arrayConstructors
this(size_t index, size_t length, string file = __FILE__,
size_t line = __LINE__, Throwable next = null)classArraySliceError : RangeError
Thrown when an out of bounds array slice is created
Fields
size_t lowerLower/upper bound passed to slice: `array[lower .. upper]`size_t lengthLength of sliced arrayConstructors
this(size_t lower, size_t upper, size_t length, string file = __FILE__,
size_t line = __LINE__, Throwable next = null)classAssertError : Error
classFinalizeError : Error
classOutOfMemoryError : Error
classInvalidMemoryOperationError : Error
Thrown on an invalid memory operation.
An invalid memory operation error occurs in circumstances when the garbage collector has detected an operation it cannot reliably handle. The default D GC is not re-entrant, so this can happen due to allocations done from within finalizers called during a garbage collection cycle.
Methods
Constructors
this(string file = __FILE__, size_t line = __LINE__, Throwable next = null )Thrown on a configuration error.
Constructors
this( string file = __FILE__, size_t line = __LINE__, Throwable next = null )classSwitchError : Error
Thrown on a switch error.
Constructors
this( string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null )classUnicodeException : Exception
Thrown on a unicode conversion error.
Fields
size_t idxConstructors
this( string msg, size_t idx, string file = __FILE__, size_t line = __LINE__, Throwable next = null )aliasAssertHandler = void function(string file, size_t line, string msg) nothrow
Gets/sets assert hander. null means the default handler is used.
classSuppressTraceInfo : Throwable.TraceInfo
Functions 26
fn
void onAssertError( string file = __FILE__, size_t line = __LINE__ ) extern(C) nothrowA callback for assert errors in D. The user-supplied assert handler will be called if one has been supplied, otherwise an AssertError will be thrown.fn
void onAssertErrorMsg( string file, size_t line, string msg ) extern(C) nothrowA callback for assert errors in D. The user-supplied assert handler will be called if one has been supplied, otherwise an AssertError will be thrown.fn
void onUnittestErrorMsg( string file, size_t line, string msg ) extern(C) nothrowA callback for unittest errors in D. The user-supplied unittest handler will be called if one has been supplied, otherwise the error will be written to stderr.fn
noreturn onRangeError( string file = __FILE__, size_t line = __LINE__ ) extern(C) @trusted pure nothrow @nogcA callback for general array bounds errors in D. A RangeError will be thrown.fn
noreturn onArraySliceError( size_t lower = 0, size_t upper = 0, size_t length = 0,
string file = __FILE__, size_t line = __LINE__ ) extern(C) @trusted pure nothrow @nogcA callback for array slice out of bounds errors in D.fn
noreturn onArrayIndexError( size_t index = 0, size_t length = 0,
string file = __FILE__, size_t line = __LINE__ ) extern(C) @trusted pure nothrow @nogcA callback for array index out of bounds errors in D.fn
noreturn onFinalizeError( TypeInfo info, Throwable e, string file = __FILE__, size_t line = __LINE__ ) extern(C) @trusted nothrowA callback for finalize errors in D. A FinalizeError will be thrown.fn
noreturn onInvalidMemoryOperationError(void * pretend_sideffect = null, string file = __FILE__, size_t line = __LINE__) extern(C) @trusted pure nothrow @nogcA callback for invalid memory operations in D. An InvalidMemoryOperationError will be thrown.fn
noreturn onForkError( string file = __FILE__, size_t line = __LINE__ ) extern(C) @trusted pure nothrow @nogcA callback for errors in the case of a failed fork in D. A ForkError will be thrown.fn
noreturn onUnicodeError( string msg, size_t idx, string file = __FILE__, size_t line = __LINE__ ) extern(C) @safe pureA callback for unicode errors in D. A UnicodeException will be thrown.fn
void _d_assertp(immutable(char) * file, uint line) extern(C)These functions must be defined for any D program linked against this library. Function calls to these are generated by the compiler and inserted into the object code.fn
void _d_arrayboundsp(immutable(char *) file, uint line) extern(C)Called when an invalid array index/slice or associative array key is accessedfn
void _d_arraybounds_slicep(immutable(char *) file, uint line, size_t lower, size_t upper, size_t length) extern(C)Called when an out of range slice of an array is createdfn
void _d_arraybounds_slice(string file, uint line, size_t lower, size_t upper, size_t length) extern(C)dittofn
void _d_arraybounds_indexp(immutable(char *) file, uint line, size_t index, size_t length) extern(C)Called when an out of range array index is accessedfn
T staticError(T, Args...)(auto ref Args args) if (is(T : Error))