From e45e486fd24aecfb8967326e6237cb6fb6e6a618 Mon Sep 17 00:00:00 2001 From: Badlop Date: Mon, 27 Apr 2009 21:36:41 +0000 Subject: * src/xml.erl: More verbose error reporting for element_to_string (thanks to Magnus Henoch)(EJAB-301) SVN Revision: 2045 --- src/xml.erl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/xml.erl') diff --git a/src/xml.erl b/src/xml.erl index c55ca0d6e..846d93c9b 100644 --- a/src/xml.erl +++ b/src/xml.erl @@ -47,12 +47,20 @@ -endif. element_to_string(El) -> + case catch element_to_string_nocatch(El) of + {'EXIT', Reason} -> + erlang:error({badxml, El, Reason}); + Result -> + Result + end. + +element_to_string_nocatch(El) -> case El of {xmlelement, Name, Attrs, Els} -> if Els /= [] -> [$<, Name, attrs_to_list(Attrs), $>, - [element_to_string(E) || E <- Els], + [element_to_string_nocatch(E) || E <- Els], $<, $/, Name, $>]; true -> [$<, Name, attrs_to_list(Attrs), $/, $>] -- cgit v1.2.3