core.exception
The
exception module defines all system-level exceptions and provides a
mechanism to alter system-level error handling.
License:Distributed under the
Boost Software License 1.0.
(See accompanying file LICENSE)
Authors:Sean Kelly and Jonathan M Davis
Source:
core/exception.d
- class RangeError: object.Error;
- Thrown on a range error.
- class AssertError: object.Error;
- Thrown on an assert error.
- class FinalizeError: object.Error;
- Thrown on finalize error.
- class HiddenFuncError: object.Error;
- Thrown on hidden function error.
- class OutOfMemoryError: object.Error;
- Thrown on an out of memory error.
- class InvalidMemoryOperationError: object.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.
- class SwitchError: object.Error;
- Thrown on a switch error.
- class UnicodeException: object.Exception;
- Thrown on a unicode conversion error.
- alias AssertHandler = void function(string file, uint line, string msg) nothrow;
nothrow @property @trusted AssertHandler assertHandler();
nothrow @property @trusted void assertHandler(AssertHandler handler);
- Gets/sets assert hander. null means the default handler is used.
- deprecated nothrow @trusted void setAssertHandler(AssertHandler h);
- Overrides the default assert hander with a user-supplied version.
Deprecated.
Please use assertHandler instead.
Parameters:
AssertHandler h |
The new assert handler. Set to null to use the default handler. |
- nothrow void onAssertError(string file = __FILE__, size_t line = __LINE__);
- A 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.
Parameters:
string file |
The name of the file that signaled this error. |
size_t line |
The line number on which this error occurred. |
- nothrow void onAssertErrorMsg(string file, size_t line, string msg);
- A 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.
Parameters:
string file |
The name of the file that signaled this error. |
size_t line |
The line number on which this error occurred. |
string msg |
An error message supplied by the user. |
- nothrow void onUnittestErrorMsg(string file, size_t line, string msg);
- A 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.
Parameters:
string file |
The name of the file that signaled this error. |
size_t line |
The line number on which this error occurred. |
string msg |
An error message supplied by the user. |
- pure nothrow @safe void onRangeError(string file = __FILE__, size_t line = __LINE__);
- A callback for array bounds errors in D. A RangeError will be thrown.
Parameters:
string file |
The name of the file that signaled this error. |
size_t line |
The line number on which this error occurred. |
Throws:
RangeError.
- pure nothrow @safe void onFinalizeError(ClassInfo info, Exception e, string file = __FILE__, size_t line = __LINE__);
- A callback for finalize errors in D. A FinalizeError will be thrown.
Parameters:
ClassInfo info |
The ClassInfo instance for the object that failed finalization. |
Exception e |
The exception thrown during finalization. |
string file |
The name of the file that signaled this error. |
size_t line |
The line number on which this error occurred. |
Throws:
FinalizeError.
- pure nothrow @safe void onHiddenFuncError(Object o);
- A callback for hidden function errors in D. A HiddenFuncError will be
thrown.
Throws:
HiddenFuncError.
- pure nothrow @trusted void onOutOfMemoryError();
- A callback for out of memory errors in D. An OutOfMemoryError will be
thrown.
Throws:
OutOfMemoryError.
- pure nothrow @trusted void onInvalidMemoryOperationError();
- A callback for invalid memory operations in D. An
InvalidMemoryOperationError will be thrown.
Throws:
InvalidMemoryOperationError.
- pure nothrow @safe void onSwitchError(string file = __FILE__, size_t line = __LINE__);
- A callback for switch errors in D. A SwitchError will be thrown.
Parameters:
string file |
The name of the file that signaled this error. |
size_t line |
The line number on which this error occurred. |
Throws:
SwitchError.
- pure @safe void onUnicodeError(string msg, size_t idx, string file = __FILE__, size_t line = __LINE__);
- A callback for unicode errors in D. A UnicodeException will be thrown.
Parameters:
string msg |
Information about the error. |
size_t idx |
String index where this error was detected. |
string file |
The name of the file that signaled this error. |
size_t line |
The line number on which this error occurred. |
Throws:
UnicodeException.
- void _d_assertm(ModuleInfo* m, uint line);
- 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.
- void _d_assert_msg(string msg, string file, uint line);
- 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.
- void _d_assert(string file, uint line);
- 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.
- void _d_unittestm(ModuleInfo* m, uint line);
- 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.
- void _d_unittest_msg(string msg, string file, uint line);
- 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.
- void _d_unittest(string file, uint line);
- 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.
- void _d_array_bounds(ModuleInfo* m, uint line);
- 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.
- void _d_arraybounds(string file, uint line);
- 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.
- void _d_switch_error(ModuleInfo* m, uint line);
- 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.
- void _d_hidden_func();
- 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.