getsentry / getsentry/sentry-cocoa

Constants for keys used in data dictionary of Breadcrump object

Open
#3,297 1 comment 0 reactions 0 assignees View on GitHub
Cocoa Errors Feature
Dominant language
Swift
Stars
1.1k
Forks
418
Avg merge
2d 3h
Merged PRs (30d)
106

Description

### Problem Statement

I want to have safer experience when modifying built-in breadcrumbs but Sentry doesn't expose keys as constants

Example: safer sanitising of http breadcrumps.

### Solution Brainstorm

The easiest way to achieve a certain level of safety is to define a list of constants for each built-in breadcrumb Sentry currently reports.

**Before:**

```
options.beforeBreadcrumb = {
... data["http.query"] ...
...
}
```

**After:**

```
options.beforeBreadcrumb = {
... data[Sentry.Breadcrump.Http.QueryDataKey] ...
...
}
```

Even it's not the best way to handle passing data with a breadcrumb, it represents way safer solution because there is a connection established between providers and consumers.

Alternatively, this section could be completely restructured, and the data object could be of the 'Any' type. This would allow the client to cast the 'Any' type object to a specific type, such as 'HttpBreadcrumbData', which would be defined within Sentry

### Are you willing to submit a PR?

Yes, I can consider working on it

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.