[CLJ-1210] error message for (clojure.java.io/reader nil) — consistency for use with io/resource Created: 23/May/13 Updated: 28/Dec/14
|Affects Version/s:||Release 1.5|
|Patch:||Code and Test|
This seems to a common idiom:
(clojure.java.io/reader (clojure.java.io/resource "myfile"))
When a file is available these are the behaviors:
=> (clojure.java.io/reader "resources/myfile")
=> (clojure.java.io/resource "myfile")
=> (clojure.java.io/reader (clojure.java.io/resource "myfile"))
If the file (resource) is unavailable:
=> (clojure.java.io/reader "resources/nofile")
=> (clojure.java.io/resource "nofile")
=> (clojure.java.io/reader (clojure.java.io/resource "nofile"))
The main enhancement request is to have a better error message from `(clojure.java.io/reader nil)`. I'm not sure if io/resource should return something like 'resource "nofile" not found' or if io/reader could add a more helpful suggestion.
|Comment by Alexander Redington [ 14/Feb/14 3:13 PM ]|
This patch extends IOFactory to nil, providing error messages consistent with the default error messages provided for Object.
|Comment by Benjamin Peter [ 15/Feb/14 1:31 PM ]|
Looks like a good solution to me as a user. Thanks for the effort!
|Comment by Dennis Schridde [ 12/Jul/14 2:01 AM ]|
I would also be interested in a solution, as I am currently running into this with the ClojureScript compiler.