Skip to content

Commit

Permalink
Inner and suppressed exception support on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad Dysput committed Nov 28, 2024
1 parent 21f00b2 commit c3b79fb
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,32 @@ try {
</TabItem>
</Tabs>

### Sending Inner and Suppressed exceptions

:::warning Inner and suppressed exception support

The new inner and suppressed exception support 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": 80}}}, "severity": "WARNING"}
:::

Backtrace clients allow 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

0 comments on commit c3b79fb

Please sign in to comment.