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

Inner and suppressed exception support on Android #3028

Merged
merged 4 commits into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,32 @@
</TabItem>
</Tabs>

### Sending Inner and Suppressed exceptions

:::warning Inner and suppressed exception support

Support for inner and suppressed exceptions is available starting [email protected]

Check warning on line 321 in docs/error-reporting/platform-integrations/android/configuration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/error-reporting/platform-integrations/android/configuration.md#L321

[sauce.WordList] Use 'Android' instead of 'android'.
Raw output
{"message": "[sauce.WordList] Use 'Android' instead of 'android'.", "location": {"path": "docs/error-reporting/platform-integrations/android/configuration.md", "range": {"start": {"line": 321, "column": 77}}}, "severity": "WARNING"}
:::

Backtrace client allows sending Inner and suppressed exceptions. By default, this option is disabled. To enable inner and suppressed exception support, use the code shown below.

```java
// enable inner exceptions
backtraceClient.sendInnerExceptions(true);
// enable suppressed exceptions
backtraceClient.sendSuppressedExceptions(true);
```

Once inner or suppressed exceptions are enabled, The Backtrace client will verify the `BacktraceReport` or `exception` object passed to the `send` method. If inner/suppressed exceptions are detected, the report with the same attributes will be created for each. In addition to that, the following attributes will be generated:

| Attribute name | Attribute description |
| -------------- | ----------------------------------------------------------------------------------- |
| error.trace | Exception trace id. All exceptions in the exception chain will have the same value. |
| error.id | Current report identifier. The value is allows to identify the current report id |
| error.parent | Parent report id. Allows to identify the exception parent id |

The outer exception always has `error.trace` and `error.id`. Since this is the first error in the exception chain, the `error.parent` attribute is set to `null`. The first inner exception of the outer exception will have the same `error.trace` attribute, its own unique `error.id` attribute, and `error.parent` set to the outer exception `error.id`. Each suppressed exception of the outer exception, follows the same pattern.

## Custom Event Handlers

The `BacktraceClient` allows you to attach your custom event handlers. For example, you can trigger actions before the `send` method, as shown below.
Expand Down
Loading