A common issue I have is that the default error handler does not
display error message's exn:srcloc if it has it

racket -e "(require racket/match)" -e "(match 2)"
=>
match: no matching clause for 2
  context...:
   
/Users/endobson/proj/rnacket/plt/racket/collects/racket/match/runtime.rkt:21:0:
match:error

But no information about what match raised the issue. The handler in
DrRacket uses this info nicely in the buttons that it provides and the
highlighting.

Is this reasonable to add to the default error handler, and if so do
people have suggestions on the format?


My current .racketrc has

 (let ((old-error-display-handler (error-display-handler)))
    (error-display-handler
      (λ (str exn)
        (when (exn:srclocs? exn)
          (for ((srcloc ((exn:srclocs-accessor exn) exn)))
            (displayln (source-location->string srcloc))))
        (old-error-display-handler str exn)))))

Which is a hack but works for my interactive use. It doesn't work for
when I run a program on its own, and I don't see a way to configure
anything to do that.

_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev

Reply via email to