raven-node icon indicating copy to clipboard operation
raven-node copied to clipboard

Support chained Errors

Open jstewmon opened this issue 8 years ago • 1 comments

Do you want to request a feature or report a bug?

feature

Has someone had this problem before?

This issue was reported for the Java client in getsentry/sentry-java/issues/43 and the server getsentry/sentry/issues/842, but has not been reported for the node client.

What is the current behavior?

  • The exception field of the event is always an array of 1 error.
  • parsers.parserError does not support modifying this behavior.
  • The Error instance is not passed to dataCallback, so the exception array cannot be updated with additional exceptions parsed from the Error instance.

What is the expected behavior?

It should be possible to capture chained errors in the exceptions field.

The native Error type does not support exception chaining, but some packages provide support for error chaining. Examples are verror and nested-error-stacks.

I wouldn't necessarily expect the raven package to directly handle chained errors, since they are not part of the standard library and there is no common interface, but I see a couple of options for how this could be supported:

  • Support a errorCallback config option. The callback would take the Error as its parameter and returns either an Error or Error[]. All returned errors are parsed and added to the exception array.
  • Make the captured Error available to dataCallback, so that it can modify the exception array on the event.

jstewmon avatar Aug 16 '17 19:08 jstewmon

@kamilogorek any thoughts on this issue?

jstewmon avatar May 29 '18 16:05 jstewmon