mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-22 07:09:17 +02:00
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.
This commit is contained in:
parent
bb2b589b74
commit
371dd7a7d0
1 changed files with 2 additions and 12 deletions
|
@ -20,9 +20,9 @@
|
||||||
(define (repl)
|
(define (repl)
|
||||||
(with-handler
|
(with-handler
|
||||||
(lambda (obj)
|
(lambda (obj)
|
||||||
(display "Error: ")
|
|
||||||
(cond
|
(cond
|
||||||
((error-object? obj)
|
((error-object? obj)
|
||||||
|
(display "Error: ")
|
||||||
(display (error-object-message obj))
|
(display (error-object-message obj))
|
||||||
(if (not (null? (error-object-irritants obj)))
|
(if (not (null? (error-object-irritants obj)))
|
||||||
(display ": "))
|
(display ": "))
|
||||||
|
@ -31,18 +31,8 @@
|
||||||
(write o)
|
(write o)
|
||||||
(display " "))
|
(display " "))
|
||||||
(error-object-irritants obj)))
|
(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
|
(else
|
||||||
|
(display "Exception: ")
|
||||||
(display obj)))
|
(display obj)))
|
||||||
(newline)
|
(newline)
|
||||||
(repl))
|
(repl))
|
||||||
|
|
Loading…
Add table
Reference in a new issue