diff --git a/basis/ui/gadgets/worlds/worlds.factor b/basis/ui/gadgets/worlds/worlds.factor index 6f901c37ee..e338d6d4f4 100644 --- a/basis/ui/gadgets/worlds/worlds.factor +++ b/basis/ui/gadgets/worlds/worlds.factor @@ -30,7 +30,7 @@ ERROR: no-world-found ; : (request-focus) ( child world ? -- ) pick parent>> pick eq? [ - >r >r dup parent>> dup r> r> + [ dup parent>> dup ] 2dip [ (request-focus) ] keep ] unless focus-child ; @@ -80,7 +80,7 @@ SYMBOL: ui-error-hook : ui-error ( error -- ) ui-error-hook get [ call ] [ print-error ] if* ; -[ rethrow ] ui-error-hook set-global +ui-error-hook global [ [ rethrow ] or ] change-at : draw-world ( world -- ) dup draw-world? [ diff --git a/basis/ui/tools/debugger/debugger.factor b/basis/ui/tools/debugger/debugger.factor index 4ba4374bb8..1f019fca7c 100644 --- a/basis/ui/tools/debugger/debugger.factor +++ b/basis/ui/tools/debugger/debugger.factor @@ -35,7 +35,15 @@ M: debugger focusable-child* restarts>> ; #! No restarts for the debugger window f [ drop ] "Error" open-window ; -[ debugger-window ] ui-error-hook set-global +GENERIC: error-in-debugger? ( error -- ? ) + +M: world-error error-in-debugger? world>> gadget-child debugger? ; + +M: object error-in-debugger? drop f ; + +[ + dup error-in-debugger? [ rethrow ] [ debugger-window ] if +] ui-error-hook set-global M: world-error error. "An error occurred while drawing the world " write