Open Luyten-Orion opened 3 months ago
I agree with the suggestion but I've found Nim's exception stuff to really not enable this type of thing. The getCurrentException
has no type information, raise e
loses all type information, and if you catch TypedException as e
you must include all the possibilities for e
as of
statements else your untyped except e: raise e
will turn your proc into {.raises: [Exception].}
instead of {.raises: [JsonError].}
.
Basically I've found it to not be worth bothering with even though I previously did it in other libraries. Maybe I'll add it later but it seems super low value without better support for actually using the type information in control flow etc.
That makes sense, though it does suck Nim's type system is like this
Hey there, just a small suggestion that'd be useful, a more precise error like 'SunnyError' would be pretty useful for catching errors during JSON parsing specifically in big 'try-except' blocks