rehack the argument formatting hack

svn: r14436
This commit is contained in:
Eli Barzilay 2009-04-06 12:18:42 +00:00
parent 2cc94cbf02
commit 76c2d9eceb

View File

@ -778,12 +778,15 @@
(if (and (null? args) (null? kws)) (if (and (null? args) (null? kws))
"no arguments supplied" "no arguments supplied"
;; Hack to format arguments: ;; Hack to format arguments:
(with-handlers ([exn:fail? (with-handlers
([exn:fail?
(lambda (exn) (lambda (exn)
(format "arguments were: ~a" ;; the message can end with:
(cadr (regexp-match ;; ..., given: x; given 117 arguments total
#rx"other arguments were: (.*)$" ;; ..., given: x; other arguments were: 1 2 3
(exn-message exn)))))]) (regexp-replace #rx"^.*? given: x; (other )?"
(exn-message exn)
""))])
(apply (apply
raise-type-error 'x "x" 0 'x raise-type-error 'x "x" 0 'x
(append args (apply append (map list kws kw-args))))))]) (append args (apply append (map list kws kw-args))))))])