Crates.io | erroneous |
lib.rs | erroneous |
version | 1.0.1 |
source | src |
created_at | 2019-01-25 08:31:34.267486 |
updated_at | 2019-01-25 08:37:37.410599 |
description | Minimalistic helper for using errors |
homepage | |
repository | https://github.com/Laaas/erroneous |
max_upload_size | |
id | 110579 |
size | 19,421 |
erroneous
is a crate with two features:
Error
traitError
derive#[macro_use]
extern crate derive_more;
#[macro_use]
extern crate erroneous;
#[derive(Debug, Display, Error)]
enum ParseError {
#[display(fmt = "Found an unexpected 'a' in the input")]
UnexpectedA,
#[display(fmt = "Found an unexpected 'b' in the input")]
UnexpectedB,
#[display(fmt = "Input was empty")]
Empty,
}
Error
traitThe Error
trait is a supertrait of std::error::Error
.
It is automatically implemented for all implementors of std::error::Error
,
with some restrictions, particularly, it is Send + Sync + 'static
. This means you have
more freedom when dealing with them, and can in addition downcast dyn Error
to concrete types.
In addition, the trait also includes a helper method to iterate the chain of errors called iter
.
Error
deriveThis feature just implements std::error::Error
(and thus also erroneous::Error
) for you,
You can annotate a field in your input as #[error(source)]
to make the source
method
return that field.
erroneous
is licensed under the terms of the MIT License or the Apache License
2.0, at your choosing.