Module severity

Source
Expand description

§Severity Levels for Errors and Notifications

This module defines Severity, an enumeration of importance levels for errors and notifications in Fern Shell.

§Design Rationale

Not all problems are equal. A misspelled config key is worth warning about, but shouldn’t prevent the shell from starting. An invalid color format is an error that needs fixing, but a single module can fail without crashing the entire shell. Only truly unrecoverable situations are fatal.

By encoding severity in the type system (rather than as a string or integer), we get:

  • Exhaustive matching — The compiler ensures all severities are handled
  • Type safety — Can’t accidentally pass a string where severity is expected
  • Rich methods — Severity carries behavior (icons, ordering, etc.)

§Ordering

Severities are ordered from least to most severe:

Info < Warning < Error < Fatal

This enables filtering:

use fernctl::error::Severity;

let min_severity = Severity::Warning;
let current = Severity::Info;

if current >= min_severity {
    // Won't run - Info is less severe than Warning
}

Enums§

Severity
Severity level for errors, warnings, and notifications.