Skip to content

Instantly share code, notes, and snippets.

@guns
Created February 18, 2014 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guns/9065033 to your computer and use it in GitHub Desktop.
Save guns/9065033 to your computer and use it in GitHub Desktop.
;; Any type of error class, as CLJS uses js/Error
(defn e! [fmt & args]
(throw (AssertionError. (apply format fmt args))))
;; Exception message takes precedence over :validation-msg
["-i" "--input-directory DIR"
:validate-fn #(cond (not (ok-path? %))
(e! "Input directory path %s is malformed" (pr-str %))
(let [f (File. %)]
(and (.exists f) (not (.isDirectory f))))
(e! "Input directory %s is not a directory" (pr-str %))
:else true)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment