Hello everyone,
I am trying to wrap the `raise` operator in a procedure like so:
proc raiseException* [E: CatchableError](e: ref E; R: typedesc): R
{.raises: [E].} =
raise e
when isMainModule:
try:
newException(IOError, "").raiseException(void)
except IOError:
echo "exception caught"
Run
I tried to compile that program with Nim 0.20.2 and I had the following error:
`prog.nim(1, 79) Error: invalid type for raises/tags list`
I think the compiler verifies what raiseException can raise before the
procedure can be used, but I could be wrong.
So, is what I am trying to do possible ? And if yes, how ?