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

Allow passing in a type for errors sent with a message #680

Merged
merged 6 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions Sources/Datadog/DDRUMMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ public class DDRUMMonitor {
/// Notifies that an Error occurred in currently presented View.
/// - Parameters:
/// - message: a message explaining the Error.
/// - type: the type of Error.
/// - source: the origin of the error.
/// - stack: stack trace of the error. No specific format needed. Overwrites `file` and `line` parameters below.
/// - attributes: custom attributes to attach to the Error
/// - file: the file in which the Error occurred (the default is the file name in which this method was called).
/// - line: the line number on which the Error occurred (the default is the line number on which this method was called).
public func addError(
message: String,
type: String?,
source: RUMErrorSource = .custom,
stack: String? = nil,
attributes: [AttributeKey: AttributeValue] = [:],
Expand Down
3 changes: 2 additions & 1 deletion Sources/Datadog/RUMMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ public class RUMMonitor: DDRUMMonitor, RUMCommandSubscriber {

override public func addError(
message: String,
type: String?,
source: RUMErrorSource,
stack: String?,
attributes: [AttributeKey: AttributeValue],
Expand All @@ -323,7 +324,7 @@ public class RUMMonitor: DDRUMMonitor, RUMCommandSubscriber {
}
return nil
}()
addError(message: message, type: nil, stack: stack, source: RUMInternalErrorSource(source), attributes: attributes)
addError(message: message, type: type, stack: stack, source: RUMInternalErrorSource(source), attributes: attributes)
}

internal func addError(
Expand Down