avx-error 0.2.0

AVL Platform error handling - replacement for anyhow/thiserror
Documentation
# avx-error


**Unified error handling system for the avx ecosystem.**

[![Crates.io](https://img.shields.io/crates/v/avx-error.svg)](https://crates.io/crates/avx-error)
[![Documentation](https://docs.rs/avx-error/badge.svg)](https://docs.rs/avx-error)
[![License](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue.svg)](https://github.com/avilaops/arxis/blob/main/LICENSE-MIT)

## Features


## Features


- **Zero Dependencies** - Pure Rust (except derive macros)
- **Rich Error Context** - Chain context information
- **Error Categories** - 15+ predefined error kinds
- **Derive Macros** - Automatic trait implementations
- **no_std Compatible** - Works in embedded environments
- **Backtrace Support** - Optional std backtrace integration
- **Type-Safe** - Compile-time error handling

## Error Kinds


- `InvalidInput` - Bad input data
- `NotFound` - Resource missing
- `PermissionDenied` - Access denied
- `ConnectionFailed` - Network error
- `Timeout` - Operation timeout
- `DataCorruption` - Corrupted data
- `ConfigError` - Configuration issue
- `AuthenticationFailed` - Auth failure
- `AuthorizationFailed` - Permission failure
- `AlreadyExists` - Duplicate resource
- `ResourceExhausted` - Out of resources
- `Cancelled` - Operation cancelled
- `Internal` - Internal error
- `NotImplemented` - Feature not implemented
- `Unavailable` - Service unavailable
- `Unknown` - Unknown error

## Examples


### Basic Usage


```rust
use avx_error::{Error, ErrorKind, Result};

fn load_config(path: &str) -> Result<Config> {
    if path.is_empty() {
        return Err(Error::new(
            ErrorKind::InvalidInput,
            "Path cannot be empty"
        ));
    }

    // ...
    Ok(Config::default())
}
```

### Error Context


```rust
use avx_error::{Result, ResultExt};

fn parse_file(path: &str) -> Result<Data> {
    read_file(path)
        .context("Failed to read file")?;

    parse_json(contents)
        .with_context(|| format!("Failed to parse {}", path))?;

    Ok(data)
}
```

### Custom Errors with Derive


```rust
use avx_error::Error as avxError;

#[derive(Debug, avxError)]

enum MyError {
    IoError(std::io::Error),
    ParseError(String),
    Custom { code: i32, message: String },
}
```

### Error Matching


```rust
use avx_error::{Error, ErrorKind};

match error.kind() {
    ErrorKind::NotFound => {
        // Handle missing resource
    },
    ErrorKind::PermissionDenied => {
        // Handle access denied
    },
    _ => {
        // Handle other errors
    }
}
```

## Installation


Add to your `Cargo.toml`:

```toml
[dependencies]
avx-error = "0.3.0"
```

With derive macros:

```toml
[dependencies]
avx-error = { version = "0.3.0", features = ["derive"] }
```

For `no_std` environments:

```toml
[dependencies]
avx-error = { version = "0.3.0", default-features = false }
```

## Integration


All avx crates use `avx-error` as the foundation:

```rust
// In avx-db
pub type Result<T> = avx_error::Result<T>;

// In avx-http
impl From<HttpError> for avx_error::Error {
    fn from(err: HttpError) -> Self {
        // Convert to avx_error::Error
    }
}
```

## License


Licensed under either of:

- Apache License, Version 2.0 ([LICENSE-APACHE]LICENSE-APACHE)
- MIT license ([LICENSE-MIT]LICENSE-MIT)

at your option.