diff options
author | David Thompson <dthompson@vistahigherlearning.com> | 2020-10-11 20:58:10 -0400 |
---|---|---|
committer | David Thompson <dthompson@vistahigherlearning.com> | 2020-10-11 20:58:10 -0400 |
commit | 93ef909c52055a1bf73853e3d3eb398fa7c708be (patch) | |
tree | 1df9a04e5d19bec25d2932b303802c45dd2b3124 | |
parent | b1e037442859ecc75a6465022c71b13b87baa7e0 (diff) |
repl: Improve exception printing code.
-rw-r--r-- | starling/repl.scm | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/starling/repl.scm b/starling/repl.scm index bd8f504..7c05cb6 100644 --- a/starling/repl.scm +++ b/starling/repl.scm @@ -86,16 +86,15 @@ (let loop ((i (- (stack-length stack) 1))) (when (>= i 0) (let ((frame (stack-ref stack i))) - (print repl - (match (frame-source frame) - ((_ file line . column) - (format #f "~d: In ~a:~% ~d:~d ~a" - i file line column - (frame-procedure-name frame))) - (#f - (format #f "~d: In unknown file:~% ~a" - i - (frame-procedure-name frame))))) + (match (frame-source frame) + ((_ file line . column) + (format #t "~d: In ~a:~% ~d:~d ~a~%" + i file line column + (frame-procedure-name frame))) + (#f + (format #t "~d: In unknown file:~% ~a~%" + i + (frame-procedure-name frame)))) (loop (- i 1)))))) (define-method (eval-user-text (repl <repl>)) @@ -109,11 +108,11 @@ (print-exception (current-output-port) #f (exception-kind exception) (exception-args exception)) - (newline)))) - (let ((tag (match (fluid-ref %stacks) - ((_ . tag) tag) - (_ 0)))) - (print-backtrace repl (make-stack #t 3 tag))) + (newline) + (let ((tag (match (fluid-ref %stacks) + ((_ . tag) tag) + (_ 0)))) + (print-backtrace repl (make-stack #t 3 tag)))))) (cancel)) (lambda () (print repl |