nim / latest / exceptions.html

system/exceptions

Source Edit

Exception and effect types used in Nim code.

Types

AccessViolationDefect = object of Defect
Raised for invalid memory access errors Source Edit
AccessViolationError {....deprecated: "See corresponding Defect".} = AccessViolationDefect
Deprecated: See corresponding Defect
Source Edit
ArithmeticDefect = object of Defect
Raised if any kind of arithmetic error occurred. Source Edit
ArithmeticError {....deprecated: "See corresponding Defect".} = ArithmeticDefect
Deprecated: See corresponding Defect
Source Edit
AssertionDefect = object of Defect

Raised when assertion is proved wrong.

Usually the result of using the assert() template.

Source Edit
AssertionError {....deprecated: "See corresponding Defect".} = AssertionDefect
Deprecated: See corresponding Defect
Source Edit
DeadThreadDefect = object of Defect
Raised if it is attempted to send a message to a dead thread. Source Edit
DeadThreadError {....deprecated: "See corresponding Defect".} = DeadThreadDefect
Deprecated: See corresponding Defect
Source Edit
DivByZeroDefect = object of ArithmeticDefect
Raised for runtime integer divide-by-zero errors. Source Edit
DivByZeroError {....deprecated: "See corresponding Defect".} = DivByZeroDefect
Deprecated: See corresponding Defect
Source Edit
EOFError = object of IOError
Raised if an IO "end of file" error occurred. Source Edit
ExecIOEffect = object of IOEffect
Effect describing an executing IO operation. Source Edit
FieldDefect = object of Defect
Raised if a record field is not accessible because its discriminant's value does not fit. Source Edit
FieldError {....deprecated: "See corresponding Defect".} = FieldDefect
Deprecated: See corresponding Defect
Source Edit
FloatDivByZeroDefect = object of FloatingPointDefect

Raised by division by zero.

Divisor is zero and dividend is a finite nonzero number.

Source Edit
FloatDivByZeroError {....deprecated: "See corresponding Defect".} = FloatDivByZeroDefect
Deprecated: See corresponding Defect
Source Edit
FloatInexactDefect = object of FloatingPointDefect

Raised for inexact results.

The operation produced a result that cannot be represented with infinite precision -- for example: 2.0 / 3.0, log(1.1)

Note: Nim currently does not detect these!

Source Edit
FloatInexactError {....deprecated: "See corresponding Defect".} = FloatInexactDefect
Deprecated: See corresponding Defect
Source Edit
FloatingPointDefect = object of Defect
Base class for floating point exceptions. Source Edit
FloatingPointError {....deprecated: "See corresponding Defect".} = FloatingPointDefect
Deprecated: See corresponding Defect
Source Edit
FloatInvalidOpDefect = object of FloatingPointDefect

Raised by invalid operations according to IEEE.

Raised by 0.0/0.0, for example.

Source Edit
FloatInvalidOpError {....deprecated: "See corresponding Defect".} = FloatInvalidOpDefect
Deprecated: See corresponding Defect
Source Edit
FloatOverflowDefect = object of FloatingPointDefect

Raised for overflows.

The operation produced a result that exceeds the range of the exponent.

Source Edit
FloatOverflowError {....deprecated: "See corresponding Defect".} = FloatOverflowDefect
Deprecated: See corresponding Defect
Source Edit
FloatUnderflowDefect = object of FloatingPointDefect

Raised for underflows.

The operation produced a result that is too small to be represented as a normal number.

Source Edit
FloatUnderflowError {....deprecated: "See corresponding Defect".} = FloatUnderflowDefect
Deprecated: See corresponding Defect
Source Edit
IndexDefect = object of Defect
Raised if an array index is out of bounds. Source Edit
IndexError {....deprecated: "See corresponding Defect".} = IndexDefect
Deprecated: See corresponding Defect
Source Edit
IOEffect = object of RootEffect
IO effect. Source Edit
IOError = object of CatchableError
Raised if an IO error occurred. Source Edit
KeyError = object of ValueError

Raised if a key cannot be found in a table.

Mostly used by the tables module, it can also be raised by other collection modules like sets or strtabs.

Source Edit
LibraryError = object of OSError
Raised if a dynamic library could not be loaded. Source Edit
NilAccessDefect = object of Defect

Raised on dereferences of nil pointers.

This is only raised if the segfaults module was imported!

Source Edit
NilAccessError {....deprecated: "See corresponding Defect".} = NilAccessDefect
Deprecated: See corresponding Defect
Source Edit
ObjectAssignmentDefect = object of Defect
Raised if an object gets assigned to its parent's object. Source Edit
ObjectAssignmentError {....deprecated: "See corresponding Defect".} = ObjectAssignmentDefect
Deprecated: See corresponding Defect
Source Edit
ObjectConversionDefect = object of Defect
Raised if an object is converted to an incompatible object type. You can use of operator to check if conversion will succeed. Source Edit
ObjectConversionError {....deprecated: "See corresponding Defect".} = ObjectConversionDefect
Deprecated: See corresponding Defect
Source Edit
OSError = object of CatchableError
  errorCode*: int32          ## OS-defined error code describing this error.
Raised if an operating system service failed. Source Edit
OutOfMemDefect = object of Defect
Raised for unsuccessful attempts to allocate memory. Source Edit
OutOfMemError {....deprecated: "See corresponding Defect".} = OutOfMemDefect
Deprecated: See corresponding Defect
Source Edit
OverflowDefect = object of ArithmeticDefect

Raised for runtime integer overflows.

This happens for calculations whose results are too large to fit in the provided bits.

Source Edit
OverflowError {....deprecated: "See corresponding Defect".} = OverflowDefect
Deprecated: See corresponding Defect
Source Edit
RangeDefect = object of Defect
Raised if a range check error occurred. Source Edit
RangeError {....deprecated: "See corresponding Defect".} = RangeDefect
Deprecated: See corresponding Defect
Source Edit
ReadIOEffect = object of IOEffect
Effect describing a read IO operation. Source Edit
ReraiseDefect = object of Defect
Raised if there is no exception to reraise. Source Edit
ReraiseError {....deprecated: "See corresponding Defect".} = ReraiseDefect
Deprecated: See corresponding Defect
Source Edit
ResourceExhaustedError = object of CatchableError
Raised if a resource request could not be fulfilled. Source Edit
StackOverflowDefect = object of Defect
Raised if the hardware stack used for subroutine calls overflowed. Source Edit
StackOverflowError {....deprecated: "See corresponding Defect".} = StackOverflowDefect
Deprecated: See corresponding Defect
Source Edit
TimeEffect = object of RootEffect
Time effect. Source Edit
ValueError = object of CatchableError
Raised for string and object conversion errors. Source Edit
WriteIOEffect = object of IOEffect
Effect describing a write IO operation. Source Edit

© 2006–2024 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/exceptions.html