Sentry-javascript: Save additional error properties to `extra` under the error type

Created on 11 Aug 2016  ·  3Comments  ·  Source: getsentry/sentry-javascript

I'm currently saving error properties under the extra portion of the error type manually, however it would be convenient if this was supported in raven-js the same way it is done in raven-node:

https://github.com/getsentry/raven-node/blob/master/lib/parsers.js#L30-L39

Most helpful comment

Wow, I didn't even realize raven-node did that. Hmm ... yeah, I think we can make the same change.

All 3 comments

Wow, I didn't even realize raven-node did that. Hmm ... yeah, I think we can make the same change.

Some more motivation from my end -- there are a few places in our codebase where we throw new Error('msg for sentry') with the intention that this will both notify the user that something went wrong as well as log the message and stack trace to sentry.

Cases where we hard error tend to be the most unexpected, so Ideally we could add some extra data to the sentry logs. EG in a default branch of a switch statement, if that branch was unexpected, we would like to hard error and attach the data that we were not expecting as well as any other surrounding useful context.

Even if in most the extra param is simple, stringify-ing them in the error message is not ideal since then the errors would not de-dupe.

Please see conversation in #483 – totally missed this issue earlier, sorry.

Was this page helpful?
0 / 5 - 0 ratings