summaryrefslogtreecommitdiff
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
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.
-rw-r--r--chickadee.scm28
-rw-r--r--chickadee/sdl.scm2
2 files changed, 16 insertions, 14 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
diff --git a/chickadee/sdl.scm b/chickadee/sdl.scm
index b00e30e..948b351 100644
--- a/chickadee/sdl.scm
+++ b/chickadee/sdl.scm
@@ -85,7 +85,7 @@
(controller-press (const #t))
(controller-release (const #t))
(controller-move (const #t))
- (error default-error-handler))
+ error)
(sdl-init)
(false-if-exception (mixer-init))
(open-audio)