summaryrefslogtreecommitdiff
path: root/chickadee.scm
diff options
context:
space:
mode:
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