Skip to content
This repository was archived by the owner on Nov 14, 2017. It is now read-only.
This repository was archived by the owner on Nov 14, 2017. It is now read-only.

Cannot handle error in buddy-sign #38

@neverfox

Description

@neverfox

I cannot handle the ExceptionInfo that is thrown from this function in buddy.sign.jwt, forcing me to use a regular try/catch:

(defn unsign
  ([message pkey] (unsign message pkey {}))
  ([message pkey opts]
   (try
     (-> (jws/unsign message pkey opts)
         (codecs/bytes->str)
         (json/parse-string true)
         (validate-claims opts))
     (catch com.fasterxml.jackson.core.JsonParseException e
       (throw (ex-info "Message seems corrupt or manipulated."
                       {:type :validation :cause :signature}))))))
(require '[buddy.sign.jwt :as jwt])

;; never handles
(with-handler! #'jwt/unsign
  clojure.lang.ExceptionInfo
  (fn [e & args]
    (raise :jwt-error)))

Is it possibly because an exception is being caught and rethrown?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions