Surfaces
Synchronous exceptions
The Dart SDK throws standardStateError / ArgumentError for misuse:
The Kotlin SDK uses
IllegalStateException and IllegalArgumentException; Swift uses Swift’s standard precondition failures with descriptive messages.
Permission failures
The SDK does not throw when a platform permission is missing. Instead:
Hosts query availability via:
checkNotificationPermission()/requestNotificationPermission()(Android).checkCallPermission()/requestCallPermission()(Android).
Native channel errors
Method-channel calls can fail if the native plugin isn’t registered (e.g. desktop builds without the platform layer). Dart’sPlatformException:
Kotlin and Swift surface these as their own typed errors at the Kotlin / Swift bridge.
Motion classifier errors
WhenenableMotionLite = true and the bundled ONNX model fails to load:
- The failure is logged with the underlying ORT error.
motionStatestaysnullfor the session.getCurrentStats()does not include motion-state fields.onEventand other behavioral metrics continue normally.
initialize() after dispose()) to retry.
Runtime gate drops
When the host wires the SDK intosynheart-core → the Synheart runtime, behavior events pass through the runtime’s consent gate. If Behavior consent is not granted, the runtime drops events at the engine seam silently. The SDK sees no error — events fire on onEvent, but the runtime never persists or aggregates them.
This is intentional: SDK-side telemetry remains coherent (UIs still see live events) while the privacy boundary is enforced past the SDK.
Validation invariants
The SDK guarantees, regardless of error state:- Numeric metrics are always finite and within their declared range (NaN/inf clamped to
0.0). BehaviorSessionSummaryis always emitted onsession.end(), even when no events flowed.BehaviorEvent.eventIdis unique within a session.BehaviorEvent.timestampis ISO-8601 UTC.
Related
- Behavior Overview — config flags that gate each surface.
- Threat Model — what’s collected and what’s not.
- Metric Definitions — numerical stability rules.
- Consent System — runtime-side
Behaviorgate.