Skip to main content

Errors and diagnostics

Softchat failures are stable, typed, and redacted. Branch on the error variant or code, never its display text, a generated-binding exception, relay prose, or an upstream cryptographic error.

Handling failures

match bob.decrypt_utf8(&message) {
Ok(plaintext) => display(plaintext),
Err(SoftchatError::DecryptionFailed) => discard_untrusted_message(),
Err(SoftchatError::IdentityErased) => require_reauthentication(),
Err(error) => record_code(error.code()),
}

Retry categories

FailureTypical action
malformed, invalid, oversized, unsupportedpermanent rejection of that input
authentication/decryption failurediscard untrusted value; do not reveal details
erased/closed/cancelled statecreate a new authority or state object when policy permits
relay retryable deliverypersist and retry under the session’s requested policy
external signer cancellationreturn to the user flow without automatic signing retry
internal failurerecord only build fingerprint, stable code, and safe host context

Build fingerprint

The build fingerprint identifies the semantic version, source revision, protocol profile, target architecture, and target operating system. Include it with a bug report to distinguish package skew without logging account data.

let fingerprint = build_fingerprint();

Diagnostics snapshot

The process-local snapshot reports aggregate operation counts, rejected operations, and input/output bytes. It deliberately excludes keys, plaintext, ciphertext, URLs, relay frames, event content, and identifiers.

let counters = diagnostics_snapshot();

Diagnostics are counters, not an audit trail. If an application needs operation correlation, generate its own non-secret trace ID outside the SDK.