On 5 February 2018 at 10:17, Marcus Denker <marcus.den...@inria.fr> wrote:
> Hello, > > The Sunit-Debugger does a stack search on startup to find the test related > exception. > > It might be good to do it better, especially as the debug process starts > from the exception > I might be a good idea to actually keep a reference to it. > > Would there be any downside of Exception>>debug passing a reference to the > Debugger? > > Marcus > > > > On 2 Feb 2018, at 17:19, Peter Uhnák <i.uh...@gmail.com> wrote: > > > > Hi, > > > > is there a way to install a global handler for exceptions? > > > > Right now if I want to log all exceptions, I use approach from ShoreLine > and create a PreDebugAction which is activated when any "unhandled" > exception occurs. > > > > That would be good enough, however the Debugger has zero knowledge of > the exception that is actually occuring, as Exception>>debug passes on only > the title. So if I want to get back to the original exception and maybe log > it with beacon, I need to do a lot of stack and context shenanigans: > > > > MyPreDebugAction>>logException > > MyLogger > > runDuring: [ (debugger session interruptedProcess > suspendedContext stack > > detect: [ :context | context receiver > isKindOf: Exception ]) receiver emit ] > > > > > > Is there a better way to approach this? > if you own a process (you creating it) , then it is just a piece of cake, just make a topmost block with #on:do: if you don't own a process (suppose you wanna watch already existing one) , it can be done by injecting own context at the bottom of stack , well, unless there are exception handler(s) upper, that catch any exception(s) before you can see them. I think a much better way would be to watch exceptions even before they being handled, for this, i would override Exception>>#signal and add some kind of logging or notification .. well, anything you see fit. That's, of course, a kind of dangerous, be careful. Do not attempt to throw new exceptions while processing just signaled one, else you'll get infinite recursion :) > > > Thanks, > > Peter > > > -- Best regards, Igor Stasenko.