Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error Types

All fallible operations in cargo-ninety-nine return Result<T, NinetyNineError>.

NinetyNineError

A comprehensive error enum covering all failure modes, derived with thiserror.

#![allow(unused)]
fn main() {
pub enum NinetyNineError {
    ConfigParse { source: toml::de::Error },
    ConfigIo { path: PathBuf, source: std::io::Error },
    NoRunnerAvailable,
    RunnerExecution { message: String },
    InvalidConfig { message: String },
    BinaryDiscovery { message: String },
    TestListing { binary: PathBuf, message: String },
    TestNotFound { name: String },
    FilterParse { message: String },
    Io { source: std::io::Error },
    Json { source: serde_json::Error },
    Storage { source: rusqlite::Error },
    PostgresStorage { source: tokio_postgres::Error },
    PostgresPool { message: String },
}
}

Error Categories

Configuration Errors

VariantDisplay MessageCause
ConfigParsefailed to parse config: {source}TOML syntax error or invalid field value
ConfigIofailed to read config file {path}: {source}File exists but cannot be read (permissions, etc.)
InvalidConfiginvalid configuration: {message}Logical configuration error (e.g., Postgres backend without connection config)

Runner Errors

VariantDisplay MessageCause
NoRunnerAvailableno test runner available: install cargo-nextest or use cargo testNeither cargo-nextest nor cargo test found
RunnerExecutionrunner execution failed: {message}Test binary failed to spawn or produced unexpected output
BinaryDiscoverybinary discovery failed: {message}cargo test --no-run failed or produced unparseable output
TestListingtest listing failed for {binary}: {message}Test binary --list invocation failed
TestNotFoundtest not found: {name}Requested test does not exist in the project

Filter Errors

VariantDisplay MessageCause
FilterParsefilter parse error: {message}Invalid filter DSL syntax

Storage Errors

VariantDisplay MessageCause
Storagestorage error: {source}SQLite operation failed (auto-converted from rusqlite::Error)
PostgresStoragepostgres storage error: {source}PostgreSQL operation failed (auto-converted from tokio_postgres::Error)
PostgresPoolpostgres pool error: {message}Connection pool exhausted or configuration error

I/O and Serialization Errors

VariantDisplay MessageCause
Ioio error: {source}Generic I/O failure (auto-converted from std::io::Error)
Jsonjson serialization error: {source}JSON serialization/deserialization failure (auto-converted from serde_json::Error)

Automatic Conversions

The following From implementations allow ? propagation:

Source TypeTarget Variant
std::io::ErrorIo
serde_json::ErrorJson
rusqlite::ErrorStorage
tokio_postgres::ErrorPostgresStorage

Error Handling in Practice

All errors are displayed to stderr in the main entry point and cause the process to exit with code 1:

#![allow(unused)]
fn main() {
// Simplified from main.rs
match run(args).await {
    Ok(()) => {}
    Err(e) => {
        eprintln!("error: {e}");
        std::process::exit(1);
    }
}
}

When --verbose is enabled, the tracing subscriber is set to debug level, providing additional context before errors surface.