import std/errorcodes proc p(x: int) {.raises.} = if x < 0: raise ErrorCode.RangeError use x
Not the best but there is precedent.