Skip to content

Commit

Permalink
wrap compile-file in try/catch
Browse files Browse the repository at this point in the history
when compiling a directory via compile-dir and one
file fails to compile, it can be kinda hard to track
down which file actually failed to compile.
  • Loading branch information
Thomas Heller authored and swannodette committed Mar 12, 2013
1 parent 2e1ee41 commit 1ad0b8d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/clj/cljs/compiler.clj
Expand Up @@ -839,10 +839,13 @@
(let [src-file (io/file src)
dest-file (io/file dest)]
(if (.exists src-file)
(if (requires-compilation? src-file dest-file)
(do (mkdirs dest-file)
(compile-file* src-file dest-file))
(parse-ns src-file dest-file))
(try
(if (requires-compilation? src-file dest-file)
(do (mkdirs dest-file)
(compile-file* src-file dest-file))
(parse-ns src-file dest-file))
(catch Exception e
(throw (ex-info (str "failed compiling file:" src) {:file src} e))))
(throw (java.io.FileNotFoundException. (str "The file " src " does not exist.")))))))

(comment
Expand Down

0 comments on commit 1ad0b8d

Please sign in to comment.