try to make the bug report form more robust when the

attempt to get the (nonexistent) captcha fails
This commit is contained in:
Robby Findler 2013-02-09 11:43:39 -06:00
parent 916f5d8ede
commit 5c21ab0e42

View File

@ -24,7 +24,10 @@
(define (get-captcha-text)
(let* ([s (port->string (get-pure-port captcha-text-url))]
[s (regexp-replace #px"^\\s+" s "")]
[s (regexp-replace #px"\\s+$" s "")])
[s (regexp-replace #px"\\s+$" s "")]
[s (if (<= (string-length s) 200)
s
(substring s 0 200))])
(and ((string-length s) . > . 0) s)))
(preferences:set-default 'drracket:email "" string? #:aliases '(drscheme:email))
@ -221,7 +224,8 @@
(and captcha-question
(get-text-from-user
"Are you human?" ; FIXME: use string-constant
captcha-question bug-frame)))
captcha-question
bug-frame)))
(define post-data
(let* ([q (if captcha-answer
`([captcha . ,captcha-answer]
@ -266,7 +270,13 @@
[(string? to-render)
(let ([str (string-append "<pre>\n\nERROR:\n"to-render"\n</pre>\n")])
(render-error (open-input-string str)))]
[(exn? to-render) (render-error (exn-message to-render))]
[(exn? to-render)
(define sp (open-output-string))
(fprintf sp "~a\n" (exn-message to-render))
(for ([x (in-list (continuation-mark-set->context
(exn-continuation-marks to-render)))])
(fprintf sp " ~s\n" x))
(render-error (get-output-string sp))]
[(or (input-port? to-render) (not to-render))
(queue-callback
(λ ()