# CTErrors: A Rust Error Handling Module
A lightweight, descriptive error enumeration for Rust projects, designed to handle common file system operations, data validation, and custom error messaging.
## Features
- **File System Errors**: Comprehensive coverage for reading, writing, creating, and deleting files.
- **Data Validation**: Built-in variants for index bounds, length limits, and type/value integrity.
- **Custom Errors**: Flexible `CustomError(String)` variant for domain-specific error messages.
- **Ease of Use**: Implements `Debug`, `Clone`, `PartialEq`, and `Display`.
## Installation
Add this module to your project by including the source in your `src/` directory (e.g., `src/errors.rs`).
## API Reference
|FileWriteError|Error occurred while writing to a file.
|FileCreateError|Error occurred while creating a file.
|FileDeleteError|Error occurred while deleting a file.
|FileReadError|Error occurred while reading a file.
|ByteReadError|Error occurred while reading a byte.
|ByteWriteError|Error occurred while writing a byte.
|ContentsEmpty|Contents of the file are empty.
|IndexError|Index out of bounds.
|MaxLengthExceeded|Maximum length exceeded.
|TypeError,|Key error.
|ValueError|Value error.
|NotFound|Resource or item not found.
|CustomError(String)|A dynamic error message.
## Usage
### Basic Example
```rust
use crate::errors::CTErrors;
fn read_config(path: &str) -> Result<String, CTErrors> {
if path.is_empty() {
return Err(CTErrors::FileReadError);
}
// Simulate finding nothing
Err(CTErrors::NotFound)
}
fn main() {
match read_config("") {
Err(e) => println!("Error encountered: {}" , e),
_ => println!("Success!"),
}
}
```