registers sym as a symbolic exception type.
RegisterExceptionType[sym,parent]
registers sym as a symbolic exception type with the parent exception type parent.
RegisterExceptionType[sym,{parent1,…}]
registers sym as a symbolic exception type with the parent exception types {parent1, …}.
RegisterExceptionType
registers sym as a symbolic exception type.
RegisterExceptionType[sym,parent]
registers sym as a symbolic exception type with the parent exception type parent.
RegisterExceptionType[sym,{parent1,…}]
registers sym as a symbolic exception type with the parent exception types {parent1, …}.
Details
- In RegisterExceptionType[sym, …], the type sym must be a symbol.
- RegisterExceptionType will clear all prior definitions associated with the symbol sym and attach a number of new internal definitions to it.
- RegisterExceptionType protects the symbol sym.
- Calling RegisterExceptionType on an already registered tag is an error.
- Parent types for the type being registered are not required to be registered themselves.
- DeleteObject[sym] can be used to deregister the registered exception type sym, which must be unprotected first. It will remove sym from the exception type registry and clear all definitions associated with sym.
- Any registered child types must be deregistered before the parent type can be deregistered.
- Deregistering a registered exception type is not necessary under normal circumstances. It is a destructive and potentially unsafe operation and should be used sparingly.
Examples
open all close allBasic Examples (1)
This registers the type IOError:
RegisterExceptionType[IOError]This tests that it has been registered, in two different ways:
{ExceptionTypeRegisteredQ[IOError], MemberQ[ExceptionTypes[], IOError]}Unprotect[IOError];
DeleteObject[IOError]Scope (1)
This registers three subtypes of the exception type "GeneralError", one of which (FileReadError) is also registered as a subtype of the type IOError:
{RegisterExceptionType[ArgumentError, "GeneralError"], RegisterExceptionType[FileReadError, { "GeneralError", IOError}], RegisterExceptionType[ArgumentTypeError, ArgumentError]}One can check that the types were added to the type registry using ExceptionTypes:
ExceptionTypes["GeneralError"]The fact of type registration can also be confirmed by using ExceptionTypeRegisteredQ:
ExceptionTypeRegisteredQ /@ {ArgumentError, FileReadError, ArgumentTypeError}Unprotect[ArgumentError, FileReadError, ArgumentTypeError]
DeleteObject /@ {ArgumentTypeError, FileReadError, ArgumentError}Here, it is important that the ArgumentTypeError subtype was deleted before the type ArgumentError.
Tech Notes
Related Guides
History
Text
Wolfram Research (2026), RegisterExceptionType, Wolfram Language function, https://reference.wolfram.com/language/ref/RegisterExceptionType.html.
CMS
Wolfram Language. 2026. "RegisterExceptionType." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RegisterExceptionType.html.
APA
Wolfram Language. (2026). RegisterExceptionType. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RegisterExceptionType.html
BibTeX
@misc{reference.wolfram_2026_registerexceptiontype, author="Wolfram Research", title="{RegisterExceptionType}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/RegisterExceptionType.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_registerexceptiontype, organization={Wolfram Research}, title={RegisterExceptionType}, year={2026}, url={https://reference.wolfram.com/language/ref/RegisterExceptionType.html}, note=[Accessed: 12-June-2026]}