Skip to content

Commit 97b6d8c

Browse files
committed
DXML-39 fix error message on encoding mismatch
1 parent 4f9da0a commit 97b6d8c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • src/main/clojure/clojure/data/xml/jvm

src/main/clojure/clojure/data/xml/jvm/emit.clj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929

3030
(defn check-stream-encoding [^OutputStreamWriter stream xml-encoding]
3131
(when (not= (Charset/forName xml-encoding) (Charset/forName (.getEncoding stream)))
32-
(throw (Exception. (str "Output encoding of stream (" xml-encoding
33-
") doesn't match declaration ("
34-
(.getEncoding stream) ")")))))
32+
(throw (ex-info (str "Output encoding of writer (" (.getEncoding stream)
33+
") doesn't match declaration ("
34+
xml-encoding ")")
35+
{:stream-encoding (.getEncoding stream)
36+
:declared-encoding xml-encoding}))))
3537

3638
;; properly namespace aware version
3739
(defn- emit-attrs [^XMLStreamWriter writer attrs]

0 commit comments

Comments
 (0)