Skip to content

Instantly share code, notes, and snippets.

@wunki
Last active August 29, 2015 14:00
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 wunki/11252574 to your computer and use it in GitHub Desktop.
Save wunki/11252574 to your computer and use it in GitHub Desktop.
clojure.lang.ExceptionInfo: Request: [{:body {:foo "bar"}, :query-string nil, :uri "/users"}]<BR>==> Error: [{:foo disallowed-key, :username missing-required-key}]<BR>==> Context: [:body]
    data: {:type :coercion-error,
           :schema {:username java.lang.String},
           :data {:foo "bar"},
           :context :body}

Try destructuring it with slingshot:

(try+ (handler request)
          (catch [:type :coercion-error] {:keys [schema data]
                                          :as e} 
            (warn e)
            (invalid-request data))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment