Merge pull request #1453 from mpblair/blank-profiles

Merge in mplbair/blank-profiles

Prints better error messages for erroneous profile files, and fixes #1444.
This commit is contained in:
Jean Niklas L'orange 2014-02-17 15:36:02 +01:00
commit b0c644dd7d
2 changed files with 11 additions and 7 deletions

View file

@ -64,14 +64,10 @@
"Load profiles.clj from dir if present. Tags all profiles with its origin."
(memoize
(fn [dir]
(try
(if-let [contents (utils/read-file (io/file dir "profiles.clj"))]
(utils/map-vals contents with-meta
{:origin (str (io/file dir "profiles.clj"))}))
(catch Exception e
(binding [*out* *err*]
(println "Error reading profiles.clj from" dir)
(println (.getMessage e))))))))
{:origin (str (io/file dir "profiles.clj"))})))))
(def profiles
"Load profiles.clj from your Leiningen home and profiles.d if present."

View file

@ -26,7 +26,15 @@
"Read the contents of file if it exists."
[file]
(if (.exists file)
(read-string (slurp file))))
(try (read-string (slurp file))
(catch Exception e
(binding [*out* *err*]
(println "Error reading"
(.getName file)
"from"
(.getParent file)))
(throw e)))))
(defn symlink?
"Checks if a File is a symbolic link or points to another file."