debug-trap-handler ephemeral trap enhancement
authorAndy Wingo <wingo@pobox.com>
Tue, 5 Oct 2010 19:50:57 +0000 (21:50 +0200)
committerAndy Wingo <wingo@pobox.com>
Tue, 5 Oct 2010 19:50:57 +0000 (21:50 +0200)
* module/system/repl/error-handling.scm (call-with-error-handling): If
  the given index is false, assume this was an ephemeral trap, and don't
  print a welcome message or reference the trap by index.

module/system/repl/error-handling.scm

index 72193a8..34a158f 100644 (file)
                      ;; invoking the start-stack thunk has its own frame
                      ;; too.
                      0 (and tag 1)))
-             (error-msg (format #f "Trap ~d: ~a" trap-idx trap-name))
+             (error-msg (if trap-idx
+                            (format #f "Trap ~d: ~a" trap-idx trap-name)
+                            trap-name))
              (debug (make-debug stack 0 error-msg)))
         (with-saved-ports
          (lambda ()
-           (format #t "~a~%" error-msg)
-           (format #t "Entering a new prompt.  ")
-           (format #t "Type `,bt' for a backtrace or `,q' to continue.\n")
+           (if trap-idx
+               (begin
+                 (format #t "~a~%" error-msg)
+                 (format #t "Entering a new prompt.  ")
+                 (format #t "Type `,bt' for a backtrace or `,q' to continue.\n")))
            ((@ (system repl repl) start-repl) #:debug debug)))))
 
     (define (null-trap-handler frame trap-idx trap-name)