Skip to main content

Module error

Module error 

Source
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 tips
  • Diagnosed — Marker type that carries tips through the anyhow chain
  • DiagnoseWithTip — Extension trait for Result<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 tip

Structs§

Diagnosed
Marker type that carries a user-facing tip through the anyhow error chain.
DiagnosedError
Internal error wrapper that carries a tip alongside the original error.

Traits§

DiagnoseExt
Extension trait for attaching an explicit tip string to any Result.
DiagnoseWithTip
Extension trait for Result<T, E> where E implements ErrorTip.
ErrorTip
Contract for errors that carry user-facing remediation tips.