Crash reporting
A crash report records information about an unexpected app failure so developers can investigate it. A review-and-send step lets people decide whether to share that diagnostic information.
day-piece-crash-reporter records crashes locally and provides a review-and-send interface for the
next launch. Your app chooses the destination and when to request consent.
Add to your app
Add day-piece-crash-reporter to your app:
cargo add 'day-piece-crash-reporter@0.*'
Crate ·
API reference ·
Source.
The default ui feature includes the consent interface. Use default-features = false for
capture and transports with your own interface. No per-toolkit feature is required.
Initialize capture
Initialize once before launching the app. This API excerpt uses the app identity supplied by Day’s build and retains at most five finalized reports, the default limit.
use day_piece_crash_reporter::{Config, InitError};
pub fn initialize_reports() -> Result<(), InitError> {
Config::new().max_reports(5).init()
}
Config::init()
reconciles the previous session and installs capture hooks. A second initialization returns
an error. The report directory defaults to the app’s data directory. Keep reports out of shared
or public storage and set a retention limit appropriate to your app.
last_session()
distinguishes known crashes from an unclean exit. An unclean exit can also result from an OS kill
or power loss; do not describe every such exit as a captured crash.
Review and send reports
Add consent_banner()
to the app’s interface after initialization. It lets the person inspect, send, or discard pending
reports. Configure a transport with
Config::reporter()
before initialization; no upload destination is configured by default.
| Transport | Intended destination |
|---|---|
RestReporter | An app-owned HTTP endpoint. |
GithubIssueReporter | A GitHub issue submission flow. |
EmailReporter | The person’s email client. |
Reporter | Your own submission implementation. |
For a custom interface,
pending()
provides a signal of report metadata.
report_text()
loads a selected report, while
send()
and discard()
operate on that selection. Sending completes through a Send callback: pass results through a
Setter before updating UI state. Handle submission errors and retain
the person’s ability to discard a report.
Privacy and capture limits
Reports can contain panic messages, paths, and app context. Use
Config::redact()
to scrub panic messages before persistence. This hook is not a general guarantee that every
report field is sanitized; inspect the full report and your custom metadata before enabling
submission. Do not embed a privileged service credential in the app.
| Platform | Capture |
|---|---|
| macOS / iOS / Linux / HarmonyOS | Rust panics and native Unix faults. Native fault capture does not guarantee a complete stack trace. |
| Android | Rust panics, Unix faults, and uncaught Java exceptions. |
| Windows | Rust panics. Native Windows exception capture is not implemented. |
| Web | Initialization is a no-op and queries return empty state. |
A fatal-fault handler has strict execution limits. Keep app crash hooks minimal; present UI and perform network requests on a later launch, not inside a crash handler.
Migrating from day-break
Replace the old dependency with day-piece-crash-reporter and rename Rust references from
day_break:: to day_piece_crash_reporter::. Existing schema-1 reports and the day-break
storage directory remain readable. day diagnose continues reading those files.