improve file-loaders exception readability

This commit is contained in:
jem 2019-05-24 13:17:59 +02:00
parent f0a30e0c20
commit dfb35e06f0
2 changed files with 8 additions and 1 deletions

View file

@ -39,4 +39,8 @@
(s/defn load-test-data
[file-prefix :- s/Str]
(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}))))))

View file

@ -35,3 +35,6 @@
(is (= {:test "data"}
(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)))))