asciify error msgs

dev-fixit
Matthew Butterick 9 years ago
parent c804976b96
commit 00e9fabdb8

@ -13,7 +13,7 @@
(define result (define result
;; use handler to capture error & print localized error message ;; use handler to capture error & print localized error message
(with-handlers ([exn:fail? (λ(exn) (error (format "get: couldnt retrieve ~a from ~a" (if end (format "items ~a through ~a" start end) (format "item ~a" start)) container)))]) (with-handlers ([exn:fail? (λ(exn) (error (format "get: couldn't retrieve ~a from ~a" (if end (format "items ~a through ~a" start end) (format "item ~a" start)) container)))])
(let ([end (if (and (equal? end #f) (sliceable-container? container)) (add1 start) end)]) (let ([end (if (and (equal? end #f) (sliceable-container? container)) (add1 start) end)])
(cond (cond
[(list? container) (for/list ([i (in-range start end)]) (list-ref container i))] [(list? container) (for/list ([i (in-range start end)]) (list-ref container i))]

@ -118,8 +118,8 @@
(let* ([duplicate-keys (filter-not empty? (hash-map (frequency-hash (->list x)) (let* ([duplicate-keys (filter-not empty? (hash-map (frequency-hash (->list x))
(λ(element freq) (if (> freq 1) element '()))))]) (λ(element freq) (if (> freq 1) element '()))))])
(error (string-append "members-unique? failed because " (if (= (len duplicate-keys) 1) (error (string-append "members-unique? failed because " (if (= (len duplicate-keys) 1)
"item isnt" "item isn't"
"items arent") " unique:") duplicate-keys)) "items aren't") " unique:") duplicate-keys))
result)) result))

Loading…
Cancel
Save