error-kit 🦀 ⚡
A comprehensive, developer-focused error handling infrastructure built on top of thiserror, providing standardized error messages, common error patterns, and ergonomic helper functions.
Design Principles 🏗️
This crate provides a "batteries-included" approach to error handling with these core principles:
Developer-Focused Messages 👩💻
Error messages provide technical context for developers, not end-user UI text.
Type-Safe Enums Over Error Codes 🔢
Uses thiserror::Error derive macro for compile-time checking, pattern matching, and IDE support.
Helper Functions Over Macros 🚀
Explicit, debuggable functions instead of complex macros:
// Clear and debuggable ✨
io_error
// Instead of macro magic 🪄❌
error!
Centralized Message Constants 📚
Error messages defined as constants in a dedicated messages module for consistency and maintainability.
Usage Examples 💡
Adding error-kit to Your Project 📦
// Add to Cargo.toml
error-kit = "0.1.0"
Using error-kit 🚀
use CommonError;
// Using helper functions 🔧
let io_err = io_error;
let filename_err = filename_error;
// Using predefined message constants 📝
let timeout_err = Timeout; // Uses messages::TIMEOUT_EXCEEDED
// Simple error handling 🎯
let result: = some_operation;
match result
// Or pattern matching when you need specific handling
match result
Module Structure 🏗️
The error-kit crate is organized into focused modules:
messages: Centralized error message constantsconstructors: Ergonomic constructor functionstypes: Main error enum withthiserrorintegration
use ;
Use Cases 🎯
- Library Development: Structured error types with consistent messaging
- Application Development: Standardized error handling with reduced boilerplate
- Error Infrastructure: Foundation for domain-specific error crates and company standards
Future Vision 🔮
This crate aims to become the go-to foundation for error handling, providing:
- Domain-specific error modules (network, filesystem, parsing, etc.)
- Error reporting utilities and formatters
- Integration helpers for popular crates
- Best practice examples and patterns
- Community-driven error message standards
Contributing 🤝
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
License 📄
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.