Hopefully fix stack effects of error hooks to throw when required.

locals-and-roots
John Benediktsson 2016-03-28 22:27:35 -07:00
parent be2b048920
commit 7d0c596c92
6 changed files with 13 additions and 11 deletions

View File

@ -12,9 +12,11 @@ IN: debugger.threads
", " % dup quot>> unparse-short % ")" %
] "" make swap write-object ":" print ;
! ( error thread -- )
! ( error thread -- * )
[
dup initial-thread get-global eq? [ die ] [
dup initial-thread get-global eq? [
die drop throw
] [
[
error-in-thread. nl
print-error nl

View File

@ -18,7 +18,7 @@ TUPLE: io-thread < thread ;
"I/O wait"
io-thread new-thread ;
M: io-thread error-in-thread [ die ] call( error thread -- * ) ;
M: io-thread error-in-thread die drop throw ;
: start-io-thread ( -- )
t io-thread-running? set-global

View File

@ -4,7 +4,7 @@ ui.gadgets.worlds ;
[
"Error"
"The application encountered an error it cannot recover from and will now exit."
system-alert die
system-alert die 1 exit
]
[ ui-error-hook set-global ]
[ callback-error-hook set-global ]

View File

@ -11,9 +11,9 @@ IN: ui.debugger
! ( error -- )
[ error-alert ] ui-error-hook set-global
! ( error -- )
! ( error -- * )
[
ui-running? [ dup error-alert ] [ dup print-error ] if die
ui-running? [ dup error-alert ] [ dup print-error ] if die throw
] callback-error-hook set-global
M: world-error error.

View File

@ -203,7 +203,7 @@ TUPLE: world-error error world ;
C: <world-error> world-error
SYMBOL: ui-error-hook
SYMBOL: ui-error-hook ! ( error -- )
: ui-error ( error -- )
ui-error-hook get [ call( error -- ) ] [ die drop ] if* ;

View File

@ -117,18 +117,18 @@ PRIVATE>
GENERIC: error-in-thread ( error thread -- * )
SYMBOL: thread-error-hook ! ( error thread -- )
SYMBOL: thread-error-hook ! ( error thread -- * )
thread-error-hook [ [ die ] ] initialize
thread-error-hook [ [ die drop throw ] ] initialize
M: object error-in-thread ( error thread -- * )
M: object error-in-thread
thread-error-hook get-global call( error thread -- * ) ;
: in-callback? ( -- ? ) CONTEXT-OBJ-IN-CALLBACK-P context-object ;
SYMBOL: callback-error-hook ! ( error -- * )
callback-error-hook [ [ die ] ] initialize
callback-error-hook [ [ die throw ] ] initialize
: rethrow ( error -- * )
dup save-error