taoensso / telemere

Structured telemetry library for Clojure/Script
https://www.taoensso.com/telemere
Eclipse Public License 1.0
200 stars 5 forks source link

`catch->error` breaks with forms that are maps #29

Closed rschmukler closed 1 month ago

rschmukler commented 1 month ago

If you have map as your form you will get an exception that calling catch->error with a single map form is usually an error, even if you don't call it with a single map. Example:

(tel/catch->error!
  {:id   :an-error
   :msg  "An error occurred"
   :data {:a 1
          :b 2}}
  {:foo 5})
;; => Invalid catch->error!

As a work around you can do

(tel/catch->error!
  {:id   :an-error
   :msg  "An error occurred"
   :data {:a 1
          :b 2}}
  (do {:foo 5}))
ptaoussanis commented 1 month ago

@rschmukler Hi Ryan- sorry about that! This is a known issue that's been fixed on master and is just waiting on a new release.

I'm expecting to cut RC1 before the end of October, but your workaround looks good in the meantime 👍

rschmukler commented 1 month ago

Sorry for the double report, I should have searched a bit before reporting!

ptaoussanis commented 1 month ago

No worries! Actually, the problem was never reported - so wouldn't have been found in an issue. Just noticed it myself one day.

I'll keep this until there's an official release out with the fix 👍

ptaoussanis commented 1 month ago

Fixed in v1.0.0-RC1.