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

fix: missing error_message when reporting client's unknown error #94

Merged
Merged
Show file tree
Hide file tree
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
14 changes: 12 additions & 2 deletions Bucketeer/Sources/Internal/Event/EventInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,18 @@ extension BKTError {
)
)
metricsEventType = .unknownError
case .unknown:
metricsEventData = .unknownError(.init(apiId: apiId, labels: labels))
case .unknown(let message, _):
metricsEventData = .unknownError(
.init(
apiId: apiId,
labels: labels.merging(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tag is also missing in the metric event labels.
Can you confirm?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tag is inserted here

and we are using merging() to merge new changes to the input map

[
"error_message":message
]
, uniquingKeysWith: { (first, _) in first }
)
)
)
metricsEventType = .unknownError
}
return .metrics(.init(
Expand Down
10 changes: 9 additions & 1 deletion BucketeerTests/BKTErrorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,15 @@ class BKTErrorTests: XCTestCase {
metricsEventData = .internalSdkError(.init(apiId: apiId, labels: labels))
metricsEventType = .internalError
case .unknown:
metricsEventData = .unknownError(.init(apiId: apiId, labels: labels))
metricsEventData = .unknownError(
.init(
apiId: apiId,
labels: [
"key": "value",
"error_message": "unknown"
]
)
)
metricsEventType = .unknownError
case .unknownServer:
metricsEventData = .unknownError(
Expand Down
Loading