Custom exceptions

It is possible to create custom exceptions. A custom exception is a custom type:

  1. type
  2. LoadError* = object of Exception

Ending the custom exception’s name with Error is recommended.

Custom exceptions can be raised just like any other exception, e.g.:

  1. raise newException(LoadError, "Failed to load data")