Expand description
Error tip and diagnostic wrapper types for user-facing error reporting.
This module provides the error reporting contract for the semver-analyzer:
ErrorTip— Trait for errors that carry remediation tipsDiagnosed— Marker type that carries tips through theanyhowchainDiagnoseWithTip— Extension trait forResult<T, E: ErrorTip>DiagnoseExt— Extension trait for attaching explicit tip strings
§How It Works
Language implementations define domain-specific error types (e.g.,
WorktreeError for TypeScript) and implement ErrorTip on them.
At the boundary where errors enter anyhow::Result, call .diagnose()
to capture the tip into a Diagnosed marker. The CLI renderer walks
the anyhow chain and extracts the tip via a single
downcast_ref::<Diagnosed>().
Language impl Orchestrator CLI
───────────── ──────────── ───
WorktreeError::TscFailed .context("...") render_error()
→ .diagnose() → propagates → downcast Diagnosed
→ Diagnosed { tip } added via ? → shows tipStructs§
- Diagnosed
- Marker type that carries a user-facing tip through the
anyhowerror chain. - Diagnosed
Error - Internal error wrapper that carries a tip alongside the original error.
Traits§
- Diagnose
Ext - Extension trait for attaching an explicit tip string to any
Result. - Diagnose
With Tip - Extension trait for
Result<T, E>whereEimplementsErrorTip. - Error
Tip - Contract for errors that carry user-facing remediation tips.