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
| Parameter | Type | Required | Description |
|---|---|---|---|
name / error | String / Error | Yes | Error name or a caught Swift Error instance |
observedTimeStampInMs | Int64 | Yes | Timestamp in epoch milliseconds |
params | [String: Any?] | No | Context 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