From 7bc1af89c80dbb9093e28d3fe7c525e369543dd6 Mon Sep 17 00:00:00 2001 From: dybvig Date: Sun, 21 Aug 2016 10:54:26 -0400 Subject: [PATCH] - instead of default-exception handler, new-cafe establishes a handler that calls the current value of base-exception-handler so the handler can be overridden, as we do in our own make files. cafe.ss, 7.ms original commit: 99b763e30d22b205106ef9a84ea2e0a928fd0b30 --- LOG | 5 +++++ mats/7.ms | 19 +++++++++++++++++++ s/cafe.ss | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/LOG b/LOG index ffcdf6e7cf..9437c7ac66 100644 --- a/LOG +++ b/LOG @@ -291,3 +291,8 @@ not-like patterns. cp0.ss, cp0.ms, 4.ms +- instead of default-exception handler, new-cafe establishes a handler + that calls the current value of base-exception-handler so the handler + can be overridden, as we do in our own make files. + cafe.ss, + 7.ms diff --git a/mats/7.ms b/mats/7.ms index 21ea012a2f..6d09c78b23 100644 --- a/mats/7.ms +++ b/mats/7.ms @@ -3300,6 +3300,25 @@ evaluating module init (new-cafe)) (get)))) "Huh? \nException: invalid syntax (if)\nHuh? \n") + (equal? + (separate-eval + `(let ([ip (open-string-input-port " + (base-exception-handler + (lambda (c) + (fprintf (console-output-port) \"~%>>> \") + (display-condition c (console-output-port)) + (fprintf (console-output-port) \" <<<~%\") + (reset))) + (if)")]) + (let-values ([(op get) (open-string-output-port)]) + (parameterize ([console-input-port ip] + [console-output-port op] + [console-error-port op] + [#%$cafe 0] + [waiter-prompt-string "Huh?"]) + (new-cafe)) + (get)))) + "\"Huh? Huh? \\n>>> Exception: invalid syntax (if) <<<\\nHuh? \\n\"\n") ) (mat reset diff --git a/s/cafe.ss b/s/cafe.ss index 74cdb4c6f5..8f928f68fb 100644 --- a/s/cafe.ss +++ b/s/cafe.ss @@ -209,7 +209,8 @@ Type e to exit interrupt handler and continue (reset-handler (lambda () (k2))) (call/cc (lambda (k) (set! k2 k))) (parameterize ([$cafe (+ ($cafe) 1)] [$interrupt reset]) - (with-exception-handler default-exception-handler + (with-exception-handler + (lambda (c) ((base-exception-handler) c)) (lambda () (waiter ($cafe) eval))))))))])))) )