Maybe I'm over-thinking this and/or misunderstanding the use case, but:

Should there maybe be a parameter to control whether exn->string
returns anything interesting? And, should it be #f by default?


Roughly, for example:

;; When current-exn->string-enabled? is #f -- the default --
;; exn->string simply returns "error".
;;
;; (The idea here is that net apps shouldn't provide this information
;; by default, exn->string is probably being used to provide "debug
;; info", and this should be enabled intentionally not by default.)
(define current-exn->string-enabled? (make-parameter #f))

;; exn->string : (or/c exn any) -> string
(define (exn->string exn)
  (cond [(not (current-exn->string-enabled?)) "error"]
        [(exn? exn) (parameterize ([current-error-port (open-output-string)])
                      ((error-display-handler) (exn-message exn) exn)
                      (get-output-string (current-error-port)))]
        [else (format "~s\n" exn))))


Admittedly, just because there's a switch to turn it on and off,
doesn't mean people will use it. (Source: Use the web for a week and
encounter .NET apps deployed to show debug stack traces on error.)
But there should be a switch, so that people can forget to use it. :)

Admittedly, most Racket web apps are probably not high-value targets,
today. But they ought to be someday, so why not plan for that?

Again, I'm sorry if I'm over-thinking this.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to