Hi Gabriel,
Gabriel Scherer wrote:
> (we can't use exceptions at all inside a backtrace handler, for example)
I'm a bit surprised by this. Part of the point of reifying traces into
datatypes (raw_backtrace, backtrace_slot) was to make them persistent.
set_uncaught_exception_handler is passed a raw trace that should not be
mutated by raising new exceptions. What breaks if you use exceptions
inside a backtrace handler?
To quote the documentation for set_uncaught_exception_handler: "If fn raises an exception, it is ignored."
This is a bit ambiguous -- it might mean
a) The uncaught exception handler you register won't get called from inside itself in the case of an uncaught exception. Nor will any such exceptions be handled by the standard exception handler; or
b) Exceptions in the handler literally have no effect.
I've done a little test just now, and it seems to be (a), so perhaps it's just in need of clarification in the documentation.
(It might be nice to have, for development, an option to have the default exception handler remain active, so it reports any exceptions escaping from the user-installed exception handler).