Typo here, I think:
we instead use course error handling it looks better
To Be Continued...
Turns out I don't understand the phrase "course error handling", but anyway.
Really nice article, I like it very much!
If you just want to get a "raise location" into various messages for the purposes of better logs then you could do something like the Linux glibc backtrace_symbols (3) at the point of the raise (gcc itself provides mostly what is needed via __builtin_return_address). On the one hand that wouldn't do all the fine-grained modeling, but OTOH it would be very low ceremony to just stick a callStack() & before " my error message".
Just an observation. Not sure if any of the various Nim logging packages do this automatically (or at all).
Nice.
Could logging or debug messages be done in a similar way?
€ for try except, Đ for debug, ₺ for logging ;)
Thanks @Araq! The course is in opposition to fine grained. Basically the difference between a try/except every statement to make sure you know what caused the exception, and having one big try/except around everything.
@cblake, this was careful wording on my part. I had initially written _where errors occurred, but changed it to _what went wrong. You are correct in that exceptions carry location information with them, and this would indeed be great for logging. But you wouldn't want to pull out a stacktrace and parse it to figure out how to deal with an error. The difference here is that you can label sections that need different treatment. Maybe logging different information for each label wasn't the best choice of example.
@ingo, logging and debugging could be tied up to this, which is kinda what I do in my sample. Or did you mean something else? For my take on logging you can have a look at my superlog example. I have fleshed it out into a library, but it's not quite ready for prime time yet.
Or did you mean something else?
Just that most of the time I see them as three different things, that can "flow together" at times. In that case one does not want to see a whole line of symbols.
`superlog`
Bookmarked.