summaryrefslogtreecommitdiff
path: root/chickadee.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2018-09-02 22:08:34 -0400
committerDavid Thompson <dthompson2@worcester.edu>2018-09-02 22:09:15 -0400
commite7bb72c94d4d20921a421dbc25be6bcf7eeabf67 (patch)
treedc77ac41ee29fc0c0dc4183758336a21697f5c7f /chickadee.scm
parent0a15a316d822f6c78a7fe7d11a23780adcb238d4 (diff)
Remove default error handler.
* chickadee.scm (default-error-handler): Delete. (call-with-error-handling): Don't catch errors if no handler is specified. (run-game): Default 'error' arg to #f. * chickadee/sdl.scm: (run-game/sdl): Likewise.
Diffstat (limited to 'chickadee.scm')
-rw-r--r--chickadee.scm28
1 files changed, 15 insertions, 13 deletions
diff --git a/chickadee.scm b/chickadee.scm
index 74faa56..f6894b0 100644
--- a/chickadee.scm
+++ b/chickadee.scm
@@ -16,8 +16,7 @@
;;; <http://www.gnu.org/licenses/>.
(define-module (chickadee)
- #:export (default-error-handler
- run-game
+ #:export (run-game
abort-game))
@@ -26,16 +25,20 @@
;;;
(define (call-with-error-handling handler thunk)
- (let ((stack #f))
- (catch #t
- (lambda ()
+ (if handler
+ (let ((stack #f))
+ (catch #t
+ (lambda ()
+ (thunk)
+ #f)
+ (lambda (key . args)
+ (handler stack key args)
+ #t)
+ (lambda (key . args)
+ (set! stack (make-stack #t 3)))))
+ (begin
(thunk)
- #f)
- (lambda (key . args)
- (handler stack key args)
- #t)
- (lambda (key . args)
- (set! stack (make-stack #t 3))))))
+ #f)))
(define-syntax-rule (with-error-handling handler body ...)
(call-with-error-handling handler (lambda () body ...)))
@@ -53,8 +56,7 @@
(define (abort-game)
(abort-to-prompt game-loop-prompt-tag #f))
-(define* (run-game #:key update render time
- (error default-error-handler)
+(define* (run-game #:key update render time error
(update-hz 60))
(let ((timestep (round (/ 1000 update-hz))))
(call-with-prompt game-loop-prompt-tag