summaryrefslogtreecommitdiff
path: root/chickadee.scm
diff options
context:
space:
mode:
authorDavid Thompson <davet@gnu.org>2018-06-24 06:49:58 -0400
committerDavid Thompson <davet@gnu.org>2018-06-24 06:49:58 -0400
commitf4a277dd225b71b5e90c7a165de9fc6e25395a73 (patch)
treef7260a82cb7a7c698203571c68eec56c11962e75 /chickadee.scm
parent58a4315656fd58284d0a562263c3d947e5992e81 (diff)
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.
Diffstat (limited to 'chickadee.scm')
-rw-r--r--chickadee.scm21
1 files changed, 10 insertions, 11 deletions
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