improve error message in `make-txexpr`

pull/2/head
Matthew Butterick 10 years ago
parent 5b0bbfa79e
commit 4de4c28261

@ -51,7 +51,15 @@
(define result (cons tag (append (if (empty? attrs) empty (list attrs)) elements))) (define result (cons tag (append (if (empty? attrs) empty (list attrs)) elements)))
(if (txexpr? result) (if (txexpr? result)
result result
(error 'make-txexpr "This can't happen"))) (error 'make-txexpr
(cond
[(not (txexpr-tag? tag))
(format "This is not a txexpr-tag: ~v" tag)]
[(not (txexpr-attrs? attrs))
(format "This is not a list of txexpr-attrs: ~v" attrs)]
[(not (txexpr-elements? elements))
(format "This is not a list of txexpr-elements: ~v" elements)]
[else ""]))))
(define/typed (txexpr->values x) (define/typed (txexpr->values x)

Loading…
Cancel
Save