From 93ef909c52055a1bf73853e3d3eb398fa7c708be Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 11 Oct 2020 20:58:10 -0400 Subject: repl: Improve exception printing code. --- starling/repl.scm | 29 ++++++++++++++--------------- 1 file 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 )) @@ -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 -- cgit v1.2.3