Skip to content

Commit 604d1e1

Browse files
committed
improve error message when file in local or git lib cant be read
1 parent 21cb08c commit 604d1e1

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Changelog
33

44
* next
55
* uber - exclude Emacs backup files from uberjar inclusion (useful with local/git deps)
6+
* uber - improve error message when file in local or git lib can't be read
67
* v0.9.3 e537cd1 on Feb 1, 2023
78
* NO CHANGES - just moved Maven artifact to io.github.clojure groupId to match git dep
89
* v0.9.2 fe6b140 on Jan 17, 2023

src/main/clojure/clojure/tools/build/tasks/uber.clj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
[clojure.tools.build.util.file :as file]
1717
[clojure.tools.build.util.zip :as zip])
1818
(:import
19-
[java.io File InputStream FileInputStream BufferedInputStream
19+
[java.io File InputStream FileInputStream BufferedInputStream IOException
2020
OutputStream FileOutputStream BufferedOutputStream ByteArrayOutputStream]
2121
[java.nio.file Files]
2222
[java.nio.file.attribute FileAttribute FileTime]
@@ -191,7 +191,12 @@
191191
fs (file/collect-files source-dir :dirs true)]
192192
(loop [[^File f & restf] fs, the-state state]
193193
(if f
194-
(let [is (when (.isFile f) (jio/input-stream f))
194+
(let [is (when (.isFile f)
195+
(try
196+
(jio/input-stream f)
197+
(catch IOException e
198+
(throw (ex-info (str "Uber task found file but can't read its content in " lib " at path " (.getPath f))
199+
{:path (.getPath f)} e)))))
195200
new-state (try
196201
(let [path (.toString (.relativize source-path (.toPath f)))
197202
source-time (FileTime/fromMillis (.lastModified f))

0 commit comments

Comments
 (0)