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

set Error.cause and other properties as "extras" #18

Closed
wants to merge 1 commit into from

Conversation

mmkal
Copy link

@mmkal mmkal commented Feb 7, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows Conventional Commits
  • Tests for the changes have been added (for bug fixes / features) - I made this change in the browser, but this PR is really just a starting point. Sadly I don't think I'll find the time to clone the repo locally, get the tests running etc.
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Other... Please describe:

What is the current behavior?

See ticket below

Closes #17

What is the new behavior?

Set cause as part of extras

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@splincode
Copy link
Member

@sevaru Could you review please?

@splincode splincode marked this pull request as ready for review February 7, 2024 06:18
@sevaru
Copy link
Contributor

sevaru commented Feb 7, 2024

Thank you for your pull request and the effort you've put into it!

Upon review, we've noticed behavior differences with the native Sentry client, particularly regarding the cause field and extra error data handling.

To align with our goal of keeping micro-sentry code and request data minimal, your suggestion to extend a class and override the prepare method is the best approach for now.

Highlights:

  • Cause Field: We follow the native Sentry client's approach to unwrap errors, using plugins like LinkedErrors.
{
  "exception": {
    "values": [
      {
        "type": "Error",
        "value": "cause exception text"
        // ...
      },
      {
        "type": "Error",
        "value": "parent error"
        // ...
      }
    ]
  }
  // ...
}
  • Extra Error Data: Instead of attaching additional fields to extras, we use contexts, as per the ExtraErrorData plugin.
{
  "contexts": {
    // ...
    "Error": { "myField": "myField" }
  }
}

Moving Forward:

We're considering adding more flexible plugin capabilities in the future, similar to your contribution.

Let us know if you interested in trying out the new plugin system once it's available!

@splincode splincode closed this Mar 29, 2024
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

Successfully merging this pull request may close these issues.

[BUG] Error cause not being respected
3 participants