From f4a277dd225b71b5e90c7a165de9fc6e25395a73 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 24 Jun 2018 06:49:58 -0400 Subject: Display proper backtraces when there is no game loop error handler. * chickadee.scm (call-with-error-handling): Do not catch errors when the error hook has nothing in it. --- chickadee.scm | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'chickadee.scm') diff --git a/chickadee.scm b/chickadee.scm index 512aa4a..e2a705f 100644 --- a/chickadee.scm +++ b/chickadee.scm @@ -83,17 +83,16 @@ (newline port))) (define (call-with-error-handling thunk) - (let ((stack #f)) - (catch #t - thunk - (lambda (key . args) - (if (hook-empty? error-hook) - (apply throw key args) - (begin - (display-game-loop-error stack key args) - (run-hook error-hook stack key args)))) - (lambda (key . args) - (set! stack (make-stack #t 3)))))) + (if (hook-empty? error-hook) + (thunk) + (let ((stack #f)) + (catch #t + thunk + (lambda (key . args) + (display-game-loop-error stack key args) + (run-hook error-hook stack key args)) + (lambda (key . args) + (set! stack (make-stack #t 3))))))) (define-syntax-rule (run-hook* args ...) (call-with-error-handling -- cgit v1.2.3