On Monday, December 8, 2014 1:29:51 AM UTC-5, Mikera wrote:
>
> How are you getting that error? Are you sure you aren't just passing a nil 
> parameter by accident? For example, I get the same error when I pass nil to 
> the "clojure.java.io/reader" function.
>
> Clojure usually throws file not found exceptions where appropriate, e.g.
>
> (use 'clojure.java.io)
>
> (reader (file "ugieceb.doc"))
>
>>
>>
I think this instance was something like (with-open [in (io/reader 
(io/resource foo))] ...) with the resource not existing yet. Obviously 
misspelling the resource name would have similar results. It didn't give me 
any trouble as I was actually intentionally missing the resource to check 
error handling. It looks like resource returns nil rather than throwing a 
not found exception, and then reader throws a much more opaque exception. 
Since people will probably often want to chain reader and resource like 
that, and only rarely condition on a resource existing, I'd suggest that 
reader react to nil with a more helpful message identifying the likely 
cause as a resource not found.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to