   [(merge-with conj res
                (validate-arg
                 (if (seq args)
-                  (parse-arg (first args) arg-descriptor-map)
+                  (try (parse-arg (first args) arg-descriptor-map)
+                       (catch Exception e
+                         {:invalid-args (assoc arg-descriptor-map
+                                          :value (first args)
+                                          :reason :not-parseable
+                                          :error (.getMessage e))}))
                   ::missing)
                 arg-descriptor-map))
    (rest args)])

(defn invalid-args-message
  [invalid-args]
  (reduce
   (fn [s {:keys [argument-name value reason]}]
     (str s "Invalid argument for " argument-name " : "
          (condp = reason
            :missing "argument missing"
            :invalid "argument invalid")
          "."))
   ""
   invalid-args))


  "Validate a parsed argument."
  [arg {:keys [optional vararg valid-fn] :as arg-descriptor}]
  (cond
   (map? arg) arg              ; propagate any error from the parse-fn

   (and (= arg ::missing) (not (or optional vararg)))
   {:invalid-args (assoc arg-descriptor :value arg :reason :missing)}

