improve file-loaders exception readability
This commit is contained in:
parent
f0a30e0c20
commit
dfb35e06f0
2 changed files with 8 additions and 1 deletions
|
@ -39,4 +39,8 @@
|
||||||
(s/defn load-test-data
|
(s/defn load-test-data
|
||||||
[file-prefix :- s/Str]
|
[file-prefix :- s/Str]
|
||||||
(let [file-path (str file-prefix ".edn")]
|
(let [file-path (str file-prefix ".edn")]
|
||||||
(read-data (io/resource file-path))))
|
(try
|
||||||
|
(read-data (io/resource file-path))
|
||||||
|
(catch IllegalArgumentException e
|
||||||
|
(throw (ex-info "unable to load test spec" {:cause e
|
||||||
|
:file-path file-prefix}))))))
|
||||||
|
|
|
@ -35,3 +35,6 @@
|
||||||
(is (= {:test "data"}
|
(is (= {:test "data"}
|
||||||
(sut/load-test-data (sut/data-file-prefix ::test-it)))))
|
(sut/load-test-data (sut/data-file-prefix ::test-it)))))
|
||||||
|
|
||||||
|
(deftest should-throw-exception
|
||||||
|
(is (thrown? Exception
|
||||||
|
(sut/load-test-data (sut/data-file-prefix ::not-existing)))))
|
||||||
|
|
Loading…
Reference in a new issue