Skip to main content

Error Tracking

Generates: Events (Log Records)

Report non-fatal errors — handled exceptions, failed API calls, validation failures — that you catch and want to track without crashing the app.

Report by Error Name

For errors you define as strings or enum cases:

Pulse.shared.trackNonFatal(
name: "api_timeout",
observedTimeStampInMs: Int64(Date().timeIntervalSince1970 * 1000),
params: [
"endpoint": "/api/v1/feed",
"timeout_ms": 5000,
"retry": false,
]
)

Report a Swift Error

For caught Error instances — the SDK extracts the type name and message automatically:

do {
let data = try await api.fetchProfile(userId: userId)
processProfile(data)
} catch let error as NetworkError {
Pulse.shared.trackNonFatal(
error: error,
observedTimeStampInMs: Int64(Date().timeIntervalSince1970 * 1000),
params: [
"user.id": userId,
"endpoint": "/api/v1/profile",
]
)
} catch {
Pulse.shared.trackNonFatal(
error: error,
observedTimeStampInMs: Int64(Date().timeIntervalSince1970 * 1000),
params: ["context": "profile_fetch"]
)
}

Parameters

ParameterTypeRequiredDescription
name / errorString / ErrorYesError name or a caught Swift Error instance
observedTimeStampInMsInt64YesTimestamp in epoch milliseconds
params[String: Any?]NoContext attributes — add anything useful for debugging

Generated Telemetry

Type: Log Record (Event)
Body: Error name or error type string
pulse.type: non_fatal
Scope Name: com.pulse.ios.sdk

Attributes

AttributeDescriptionExampleAlways Present
pulse.typeInstrumentation type"non_fatal"✅ Yes
exception.typeError name or Swift type name"api_timeout", "NetworkError"✅ Yes
exception.messageError description"The request timed out."✅ Yes
exception.stacktraceStack trace at call siteMulti-line string✅ Yes
session.idCurrent session identifier"f40364c92b85ec0c19c35a65be42b97f"✅ Yes
screen.nameActive UIViewController"FeedViewController"⚠️ If available
(your params)Custom context attributes⚠️ As provided

Sample Payload

{
"body": "NetworkError",
"attributes": {
"pulse.type": "non_fatal",
"exception.type": "NetworkError",
"exception.message": "The network connection was lost.",
"exception.stacktrace": "0 MyApp FeedViewController.loadFeed() + 128\n1 MyApp FeedViewController.viewDidLoad() + 64\n...",
"endpoint": "/api/v1/feed",
"session.id": "f40364c92b85ec0c19c35a65be42b97f",
"screen.name": "FeedViewController"
},
"scope_name": "com.pulse.ios.sdk"
}

Difference from Crash Reporting

Non-Fatal ErrorsCrashes
App continues running✅ Yes❌ No
ReportedImmediately at call siteOn next app launch
Triggered byYou, explicitlyAny unhandled exception or signal
Use forHandled errors you want to trackAny crash