aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscgilardi <scgilardi@gmail.com>2008-06-29 16:00:11 +0000
committerscgilardi <scgilardi@gmail.com>2008-06-29 16:00:11 +0000
commit31e44f821b15c9759e74280ed1df2c8b1f797d0c (patch)
treec93816b245408d158326b2518eda2cb0a696c15c
parenta2df976434057a815d2eed6cfdfacb328d3ea818 (diff)
lib.clj: refine exception in load-resource
-rw-r--r--lib.clj9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib.clj b/lib.clj
index 172d8c75..13b547b5 100644
--- a/lib.clj
+++ b/lib.clj
@@ -265,10 +265,11 @@
(let [url (cond ; coerce argument into URL
(instance? URL loc) loc
(instance? URI loc) (.toURL loc)
- (string? loc) (URL. loc)
- :else (throw (Exception.
- (str "Cannot coerce " (class loc)
- " to java.net.URL."))))]
+ (string? loc) (URL. loc))]
+ (when-not url
+ (throw
+ (Exception.
+ (str "Cannot coerce " (class loc) " to java.net.URL"))))
(with-open reader
(BufferedReader.
(InputStreamReader.