mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39: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)
|
||||
(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))
|
||||
|
|
Loading…
Add table
Reference in a new issue