circleci / rollcage

A Clojure client for Rollbar
Eclipse Public License 1.0
50 stars 28 forks source link

Sends all nested exception's ex-data grouped in sub levels #56

Open josefigueroa-nedap opened 2 years ago

josefigueroa-nedap commented 2 years ago

This PR enables the client's option :indexed-ex-data to be able to send all neted exception's ex-data grouped under an indexed level.

Background

Currently Rollcage only uses one level for the exception ex-data called custom. Under that level, an ex-data key would become custom.some_value. However, when you send nested exceptions, you don't know which exception the key belongs to, and repeated keys are overwritten, preferring the deepest exception in the tree.

So, for an exception like this:

(def e (ex-info "Third level error"                                                                                                           
                {:name "Third error" :age 50 :extra {:jwt "THIRD ERROR"}}                                                                     
                (ex-info "Second level error"                                                                                                 
                         {:name "Second error" :age 39 :extra {:jwt "SECOND ERROR"}}                                                          
                         (ex-info "First level error" {:name "First error" :age 20 :extra {:jwt "FIRST ERROR"}})))) 

you currently see something like this:

Screenshot from 2022-01-18 16-08-25

with this information:

Screenshot from 2022-01-18 16-09-16

Proposal

This PR enables a client like (rollcage/client token {:indexed-ex-data "__exception" :block-fields [:jwt]}) to have the following information in Rollbar:

Screenshot from 2022-01-18 16-08-49