Alternatively, I think you can simply supply a non-exception value to the
handler. This will suppress the red cross icon too, though.
(define (print-exn exn)
((error-display-handler)
(if (exn? exn)
(exn-message exn)
(format "~a" exn))
#f))
On Sat, Aug 29, 2020 at 8:17 AM Ro
It might make the most sense for you to extract the exn-message and print
it yourself? It should contain only the "a: undefined" part. If you want to
selectively access the stacktrace and decide whether or not to print that
first stackframe, that'll probably require a change to DrRacket, tho -- at
Thank you!
Is there a way of further suppressing info? Right now I get output like
[image: image.png] ../../make-semantics.rkt:37:13: a: undefined
which is a reference to the language implementation file rather than to the
program in the language.
The programs here are so small that suppressin
It may be that you're seeing the "clever"ness of the DrRacket repl. If the
last character printed is a newline, it only shows it when there is another
character after the newline.
Robby
On Thu, Aug 27, 2020 at 5:18 PM Sorawee Porncharoenwase <
sorawee.pw...@gmail.com> wrote:
> For stacktrace, us
For stacktrace, use error-print-context-length to suppress it:
(define (print-exn exn)
(parameterize ([error-print-context-length 0])
((error-display-handler)
(if (exn? exn)
(exn-message exn)
(format "~a" exn))
exn)))
I don’t see any extra newline though.
On Thu
This is perfect, thanks!
Two follow-up questions:
1. The error printer seems to print an extra newline at the end relative to
what the port-display-handler (for instance) shows. Is there a way to
suppress that?
2. The stack trace seems to be extracted automatically. Is there a way to
suppress it
Yes, something like this:
(define (print-exn exn)
((error-display-handler)
(if (exn? exn)
(exn-message exn)
(format "~a" exn))
exn))
On Thu, Aug 27, 2020 at 3:31 PM Shriram Krishnamurthi
wrote:
> Given an exception, is there a way to print the error using Racket'
7 matches
Mail list logo