- Use
E: Display + Debug + Send + Sync + 'static
trait bound forErrorTracer<E>
for eyre and anyhow tracers. The originalE: std::error::Error + Send + Sync + 'static
trait bound do not work well when individual crates havestd
features disabled, but hadflex-error
'sstd
feature enabled somehow.
- Add
into_detail
andinto_trace
methods to error types defined bydefine_error!
. - Export local alias to
std::error::Error
so thatstd
do not need to be available in user crate whendefine_error!
is called.
- Make the
Display
implementation of error types useDebug
to display error traces fromeyre
and other error tracers.
Breaking changes:
- The
impl
definition forstd::error::Error
is now generated based on whether thestd
feature is enabled on theflex-error
crate, instead of the user crate that callsdefine_error
.
Breaking changes:
-
Define main error types in the form of
struct Error(ErrorDetail, Trace)
instead of the type aliastype Error = ErrorReport<ErrorDetail, Trace>
. -
Remove auto derive of common traits such as
Clone
andEq
for the main error type. Users can instead implement the traits explicitly since it is no longer a type alias. -
Change the error constructor convention from
error::constructor_error()
toerror::Error::constructor()
. -
Allow multiple attributes to be given to main and sub errors in
define_error!
.
Breaking changes:
-
Update structure of
ErrorReport
fromErrorReport { detail, trace }
toErrorReport(detail, trace)
to allow simpler pattern matching. -
Auto derive common traits such as
Clone
andEq
forErrorReport
. -
Allow recursive error source using
Self
.
Breaking changes:
-
Update define syntax from
define_error!{ Error; ... }
todefine_error!{ Error { ... } }
-
Allow custom derive attributes in the form of
define_error!{ #[derive(Debug, ...)] Error { ... } }
.
- Initial draft release for flex-error.