Skip to content

Commit 48cf99c

Browse files
committed
cleanup charset handling, improve error message
1 parent 2b948b0 commit 48cf99c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/clojure/cljs/closure.clj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,15 @@
181181
(defn to-charset [charset]
182182
(cond
183183
(instance? Charset charset) charset
184-
(string? charset) (get string->charset (string/lower-case charset))
184+
(and (string? charset)
185+
(contains? string->charset (string/lower-case charset)))
186+
(get string->charset (string/lower-case charset))
185187
:else
186188
(throw
187-
(ex-info (str "Invalid :closure-output-charset " charset) {}))))
189+
(ex-info
190+
(str "Invalid :closure-output-charset " charset " given, only "
191+
(string/join ", " (keys string->charset)) " supported ")
192+
{}))))
188193

189194
(defn set-options
190195
"TODO: Add any other options that we would like to support."

0 commit comments

Comments
 (0)