# system/exceptions

Theme:

- Manual
- Standard library
- Index
- Compiler docs
- Fusion docs
- devel, stable

Search:
Source Edit

Exception and effect types used in Nim code.

# Types

    AccessViolationDefect = object of Defect

  Raised for invalid memory access errors Source Edit

    ArithmeticDefect = object of Defect

  Raised if any kind of arithmetic error occurred. Source Edit

    AssertionDefect = object of Defect

  Raised when assertion is proved wrong.

  Usually the result of using the assert() template.

  Source Edit

    DeadThreadDefect = object of Defect

  Raised if it is attempted to send a message to a dead thread. Source Edit

    DivByZeroDefect = object of ArithmeticDefect

  Raised for runtime integer divide-by-zero errors. 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

    FloatDivByZeroDefect = object of FloatingPointDefect

  Raised by division by zero.

  Divisor is zero and dividend is a finite nonzero number.

  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

    FloatingPointDefect = object of Defect

  Base class for floating point exceptions. Source Edit

    FloatInvalidOpDefect = object of FloatingPointDefect

  Raised by invalid operations according to IEEE.

  Raised by `0.0/0.0`, for example.

  Source Edit

    FloatOverflowDefect = object of FloatingPointDefect

  Raised for overflows.

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

  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

    IndexDefect = object of Defect

  Raised if an array index is out of bounds. 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

    ObjectAssignmentDefect = object of Defect

  Raised if an object gets assigned to its parent's object. 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

    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

    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

    RangeDefect = object of Defect

  Raised if a range check error occurred. 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

    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

    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