I'm trying to suppress this warning:
Warning: inherit from a more precise exception type like ValueError, IOError or OSError. If these don't suit, inherit from CatchableError or Defect. [InheritFromException]
And I tried this:
type
ReturnException* = ref object of Exception {.warning[InheritFromException]:off.}
value*: BaseType
Use this:
type
ReturnException* = ref object of CatchableError
or :
type
ReturnException* = ref object of Defect
The difference is that a CatchableException
can be caught by try/except
, while a Defect
always causes the program to exit.