Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

Error Classification

Module: src-tauri/src/error_classification.rs

Classifies terminal error messages and calculates exponential backoff delays for retry logic.

Tauri Commands

CommandSignatureDescription
classify_error_message(message: String) -> StringClassify error type
calculate_backoff_delay_cmd(retry_count, base_delay_ms, max_delay_ms, backoff_multiplier) -> f64Calculate backoff delay

Error Categories

classify_error(message) returns one of:

CategoryDescriptionExamples
"transient"Temporary, retry-safeNetwork timeout, connection reset, rate limit
"server"API server-side error5xx responses, service unavailable, auth failures from providers
"permanent"Will not resolve with retryAuth failure, not found, invalid input
"unknown"UnclassifiedDefault for unrecognized patterns

Backoff Calculation

#![allow(unused)]
fn main() {
pub fn calculate_backoff_delay(
    retry_count: u32,
    base_delay_ms: f64,
    max_delay_ms: f64,
    backoff_multiplier: f64,
) -> f64
}

Formula: min(base_delay_ms * backoff_multiplier^retry_count, max_delay_ms)

Typical usage:

  • base_delay_ms: 1000 (1 second)
  • max_delay_ms: 30000 (30 seconds)
  • backoff_multiplier: 2.0 (double each retry)

Result sequence: 1s → 2s → 4s → 8s → 16s → 30s → 30s → …

Frontend Integration

The errorHandlingStore calls these Rust functions to classify errors detected in terminal output and calculate retry delays. The store manages active retries and respects the user’s configured strategy (retry, ignore, or manual).