Crates.io | err-rs |
lib.rs | err-rs |
version | 0.0.4 |
source | src |
created_at | 2024-09-22 18:47:28.02965 |
updated_at | 2024-10-08 11:52:45.698967 |
description | Error level management |
homepage | |
repository | https://github.com/piot/err-rs |
max_upload_size | |
id | 1383201 |
size | 6,471 |
Welcome to err-rs! This library provides a simple and efficient way to categorize and handle different levels of errors in your applications.
ErrorLevel
enum.ErrorLevelProvider
trait to easily retrieve error levels.most_severe_error
to determine the highest severity from a slice of error levels.The ErrorLevel
enum provides three levels of error severity:
#[derive(Copy, Clone, Eq, PartialEq, Debug, Ord, PartialOrd)]
pub enum ErrorLevel {
Info, // âšī¸ Informative, can be ignored
Warning, // â ī¸ Should be logged, but recoverable
Critical, // â Requires immediate attention, unrecoverable
}
To use the library, implement the ErrorLevelProvider
trait in your structs or enums:
pub trait ErrorLevelProvider {
fn error_level(&self) -> ErrorLevel;
}
To include err-rs in your project, add the following to your Cargo.toml
:
[dependencies]
err-rs = "0.0.3"
This project is licensed under the MIT License - see the LICENSE file for details.