Skip to main content

Module error

Module error 

Source
Expand description

ErrorPanel - Consistent, actionable error display for RCH.

This module provides the base error display component with:

  • Red-bordered panel with error icon and title
  • Error code in header (RCH-Exxx format)
  • Context section with relevant details
  • Suggestion section with remediation steps
  • Optional stack trace (collapsed by default)
  • JSON serialization for machine output

§Example

use rch_common::ui::error::{ErrorPanel, ErrorSeverity};

let error = ErrorPanel::new("RCH-E042", "Worker Connection Failed")
    .message("Could not establish SSH connection to worker 'build1'")
    .context("Host", "build1.internal (192.168.1.50:22)")
    .context("Timeout", "30s elapsed")
    .context("Last successful", "2h 15m ago")
    .suggestion("Check if worker is online: ssh build1.internal")
    .suggestion("Verify SSH key: ssh-add -l")
    .suggestion("Run: rch workers probe build1 --verbose");

// Render to console
error.render(&console);

// Or serialize to JSON
let json = serde_json::to_string(&error)?;

Structs§

CausedBy
An error that caused this error (for error chaining).
ErrorContext
A key-value context item for error details.
ErrorPanel
ErrorPanel - The base error display component for RCH.

Enums§

ErrorSeverity
Error severity level.

Functions§

show_error
Create an error panel and render it immediately.
show_info
Create an info panel and render it immediately.
show_warning
Create a warning panel and render it immediately.