Skip to content

Commit

Permalink
RUMM-961 DDError.title is passed as error.type
Browse files Browse the repository at this point in the history
DDError.title is passed as error.kind in Logger
Now the same value is used as error.type in RUMEvents
  • Loading branch information
buranmert committed Jan 29, 2021
1 parent 8b4084a commit 0e41097
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Sources/Datadog/RUM/RUMMonitor/Scopes/RUMResourceScope.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ internal class RUMResourceScope: RUMScope {
url: resourceURL
),
source: command.errorSource.toRUMDataFormat,
stack: command.stack
stack: command.stack,
type: command.errorMessage
),
service: nil,
session: .init(hasReplay: nil, id: context.sessionID.toRUMDataFormat, type: .user),
Expand Down
3 changes: 2 additions & 1 deletion Sources/Datadog/RUM/RUMMonitor/Scopes/RUMViewScope.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ internal class RUMViewScope: RUMScope, RUMContextProvider {
message: command.message,
resource: nil,
source: command.source.toRUMDataFormat,
stack: command.stack
stack: command.stack,
type: command.message
),
service: nil,
session: .init(hasReplay: nil, id: context.sessionID.toRUMDataFormat, type: .user),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class RUMStorageBenchmarkTests: XCTestCase {
connectivity: nil,
date: Int64.random(in: Int64.min..<Int64.max),
service: .mockRandom(length: 20),
session: .init(id: UUID().uuidString, type: .user),
session: .init(hasReplay: nil, id: UUID().uuidString, type: .user),
usr: .init(
email: .mockRandom(length: 10),
id: .mockRandom(length: 10),
Expand All @@ -99,12 +99,14 @@ class RUMStorageBenchmarkTests: XCTestCase {
action: .init(count: .mockAny()),
crash: .init(count: .mockAny()),
cumulativeLayoutShift: nil,
customTimings: nil,
domComplete: nil,
domContentLoaded: nil,
domInteractive: nil,
error: .init(count: .mockAny()),
firstContentfulPaint: nil,
firstInputDelay: nil,
firstInputTime: nil,
id: UUID().uuidString,
isActive: nil,
largestContentfulPaint: nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class RUMResourceScopeTests: XCTestCase {
XCTAssertEqual(event.model.error.source, .network)
XCTAssertEqual(event.model.error.stack, "network issue explanation")
XCTAssertEqual(event.model.error.resource?.method, .post)
XCTAssertEqual(event.model.error.type, "ErrorMock")
XCTAssertNil(event.model.error.resource?.provider)
XCTAssertEqual(event.model.error.resource?.statusCode, 500)
XCTAssertEqual(event.model.error.resource?.url, "https://foo.com/resource/1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ class RUMViewScopeTests: XCTestCase {
XCTAssertNil(error.model.connectivity)
XCTAssertEqual(error.model.error.message, "view error")
XCTAssertEqual(error.model.error.source, .source)
XCTAssertEqual(error.model.error.type, "view error")
XCTAssertNil(error.model.error.stack)
XCTAssertNil(error.model.error.isCrash)
XCTAssertNil(error.model.error.resource)
Expand Down
2 changes: 2 additions & 0 deletions Tests/DatadogTests/Datadog/RUMMonitorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ class RUMMonitorTests: XCTestCase {
XCTAssertEqual(rumModel.error.message, "View error message")
XCTAssertEqual(rumModel.error.stack, "Foo.swift:100")
XCTAssertEqual(rumModel.error.source, .source)
XCTAssertEqual(rumModel.error.type, "View error message")
}
try rumEventMatchers[3].model(ofType: RUMViewEvent.self) { rumModel in
XCTAssertEqual(rumModel.view.action.count, 1)
Expand All @@ -334,6 +335,7 @@ class RUMMonitorTests: XCTestCase {
XCTAssertEqual(rumModel.error.message, "Another error message")
XCTAssertEqual(rumModel.error.stack, "Error stack")
XCTAssertEqual(rumModel.error.source, .webview)
XCTAssertEqual(rumModel.error.type, "Another error message")
}
try rumEventMatchers[5].model(ofType: RUMViewEvent.self) { rumModel in
XCTAssertEqual(rumModel.view.action.count, 1)
Expand Down

0 comments on commit 0e41097

Please sign in to comment.