try {
// ...
}
catch(const MyException &e) {
// Use "e" to write a nice error message
}
In Nim however, the only way I figured to do the same looks a bit inelegant:
try:
# ...
except MyException:
let e = (ref MyException)(getCurrentException())
# Use "e" to write a nice error message
The Nim manual says nothing about this (it does not even mention the existence of getCurrentException …), nor was I able to find some example in the Nim/standard library source codes. What is the best, most Nim-ish way to do this?