Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include additional error properties from nested error causes #3067

Open
fungairino opened this issue Oct 10, 2024 · 1 comment
Open

Include additional error properties from nested error causes #3067

fungairino opened this issue Oct 10, 2024 · 1 comment

Comments

@fungairino
Copy link

As a follow-up to #2569, it would be very helpful if each error in the cause chain was logged with all of their additional properties (rather than just the message, source, type and stack)

This would be very helpful for us in cases where we want to include additional debugging information in an error we are throwing in a deep context which is then embedded as a cause and reported to datadog. We have had to work around this by just including it in the error message for now. See: https://github.com/pixiebrix/pixiebrix-extension/pull/9262/files

For reference this was the change to support error causes:
https://github.com/DataDog/browser-sdk/pull/2602/files

@BenoitZugmeyer
Copy link
Member

Thank you for your feedbak and sorry for the delay. We are considering adding support for additional context through a dd_context property, so your usecase could look like this:

const error = new SandboxTimeoutError('Sandbox message timed out')
error.dd_context = {
  type: type,
  sent: messageMetadata?.timestamp,
  payloadSize: messageMetadata?.payloadSize,
  pendingMessageCount: pendingMessageMetadataMap.size
}
throw error

How does that sound?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants