From 371dd7a7d0e9402ae0accbcebb5272978e90f2a7 Mon Sep 17 00:00:00 2001 From: Yorick Hardy Date: Sun, 16 Feb 2025 17:58:05 +0200 Subject: [PATCH] repl: use error-object? to decide whether an error or an exception was raised This makes error messages a bit more informative. Also, if error objects become a distinct type, then the repl implementation will continue to be correct. The (deleted) second cond clause seemed to be bit redundant - I am not sure what the original intent was. --- scheme/repl.sld | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/scheme/repl.sld b/scheme/repl.sld index 6643ae60..b406325c 100644 --- a/scheme/repl.sld +++ b/scheme/repl.sld @@ -20,9 +20,9 @@ (define (repl) (with-handler (lambda (obj) - (display "Error: ") (cond ((error-object? obj) + (display "Error: ") (display (error-object-message obj)) (if (not (null? (error-object-irritants obj))) (display ": ")) @@ -31,18 +31,8 @@ (write o) (display " ")) (error-object-irritants obj))) - ((pair? obj) - (when (string? (car obj)) - (display (car obj)) - (if (not (null? (cdr obj))) - (display ": ")) - (set! obj (cdr obj))) - (for-each - (lambda (o) - (write o) - (display " ")) - obj)) (else + (display "Exception: ") (display obj))) (newline) (repl))