Skip to content

Commit

Permalink
Inner and suppressed exception support on Android (#3028)
Browse files Browse the repository at this point in the history
* Inner and suppressed exception support on Android

* Update docs/error-reporting/platform-integrations/android/configuration.md

Co-authored-by: Rick Foster <[email protected]>

* Update docs/error-reporting/platform-integrations/android/configuration.md

Co-authored-by: Rick Foster <[email protected]>

---------

Co-authored-by: Konrad Dysput <[email protected]>
Co-authored-by: Rick Foster <[email protected]>
  • Loading branch information
3 people authored Dec 3, 2024
1 parent ff828bd commit 0c5e34d
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

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

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

0 comments on commit 0c5e34d

Please sign in to comment.