CrashReporter

interface CrashReporter

Crash / non-fatal reporting behind an interface, so callers depend on the capability — not on Firebase Crashlytics or Sentry directly. Swapping in a real backend is a one-line DI change with no call-site edits.

Inheritors

Functions

Link copied to clipboard
abstract fun log(breadcrumb: String)

Leave a breadcrumb — the last N are attached to the next report.

Link copied to clipboard
abstract fun recordException(throwable: Throwable, message: String? = null)

Report a caught, non-crashing error.

Link copied to clipboard
abstract fun setCustomKey(key: String, value: String)

Attach a searchable key/value to subsequent reports.

Link copied to clipboard
open fun setEnabled(enabled: Boolean)

Telemetry kill switch — when false, subsequent reports drop silently (consent gating, the same way Crashlytics' collection-enabled flag works). Default no-op so existing implementers that don't gate telemetry keep compiling unchanged; reporters that respect consent override it.

Link copied to clipboard
abstract fun setUserId(id: String?)

Associate reports with a (non-PII) user/session identifier, or clear it with null.