Hi. I played a bit with exceptions trying to detect that given block will open the debugger. My idea was to simply catch UnhandledError which normally means that no outer code handles given error and therefore debugger is appeared. For my surprise the following example works from playground but not from the browser editor:
[MyTestError signal ] on: UnhandledError do: [ :e | self halt ] In playground you will see the halt. But from the browser the debugger will show MyTestError. After breaking my head I found that there is a difference how scripts are executed in those tools. In Playground it is a deferred action. But in the browser it is evaluated as a deep event processing code (keymap processing) and there is an outer error handler (on: Error do: ) which does some work and passes the exception further (err pass). Following script demonstrates the difference in the error processing logic when there is an outer handler: [ [MyTestError signal ] on: UnhandledError do: [ :e | self halt ] ] on: MyTestError do: [ :z | z pass] Try it from playground. Second line separately will show the halt while all together it will stop at MyTestError signal. Debugging shows that when the outer handler is processed it sets the handler context into the exception and it skips the existing handler for UnhandledError. The question: is it a feature or a bug? Think also how following code should work (unrelated to UnhandledError logic): [ [ 1/0 ] on: MyTestError do: [ :e | self halt ] ] on: ZeroDivide do: [ :z | MyTestError signal ] Currently it will show MyTestError signal. Best regards, Denis
