sw-errors

Crates.iosw-errors
lib.rssw-errors
version0.0.8
created_at2025-04-20 01:57:22.078288+00
updated_at2025-05-04 01:19:02.383531+00
descriptionA library for error parsing and pretty-printing, used across the swtools toolset.
homepage
repositoryhttps://github.com/swxtz/sw-errors
max_upload_size
id1641291
size39,652
Gustavo MendonΓ§a (swxtz)

documentation

README

πŸ“¦ sw-errors

A Rust library for parsing and displaying error messages in a clearer and more user-friendly way.

✨ Features

  • Structured error parsing
  • Human-friendly error display
  • Support for multiple output formats (JSON, plain text, etc.)
  • Easy integration with logging or CLI tools

πŸš€ Installation

Add this to your Cargo.toml:

[dependencies]
sw-errors = "0.1"

πŸ› οΈ Usage example

use sw_errors::ErrorParser;

fn main() {
    let raw_error = "thread 'main' panicked at 'index out of bounds', src/main.rs:10:5";
    
    let parsed = ErrorParser::new(raw_error).parse();

    println!("{}", parsed.pretty());
}

🧠 How it works

This library analyzes raw error messages and extracts useful information such as:

  • Error type
  • Code location
  • Root cause (if available)

πŸ’‘ Motivation

Rust error messages can often be verbose or hard to understand, especially for beginners. This library aims to make them more readable and approachable.

πŸ“‹ Roadmap

  • Parser for common panics
  • Support for anyhow::Error
  • Support for thiserror
  • CLI tool to pretty-print errors in the terminal

🀝 Contributing

Contributions are very welcome! Check out the CONTRIBUTING.md file to get started.

πŸ“„ License

Apache 2.0

Commit count: 0

cargo fmt