Releases: knox-networks/bigerror
v0.9.0
What's Changed
- Added
OptionReport::expect_by_fn
by @mkatychev in #16 - bigerror 0.9.x by @mkatychev in #17
Full Changelog: v0.8.2...v0.9.0
v0.8.2
What's Changed
- Added
kv!
macro to provide aKeyValue
shorthand by @mkatychev in #11 - Added
attachment::Dbg
by @mkatychev in #12 - Only increment location on
.into_ctx()
by @mkatychev in #15
Full Changelog: v0.8.1...v0.8.2
v0.8.1
v0.8.0
v0.7.0
Changelog
[0.7.0] - 2024-03-27
- Added
context::Timeout
- Added
attachment::DisplayDuration
- Added
Reportable::with_type_status
- Added
ClearResult
trait for mappingOk(T)
->Ok(())
andErr(E)
->Err(())
types respectively
Add expect_field!
macro #6
Added expect_field!
macro:
https://github.com/knox-networks/bigerror/blob/93b087f0ee8447b55ceb67efd980711d0c6cfba6/src/lib.rs#L982-L988
the above expect_field!
invocation desugars into:
// ...
let my_field = bigerror::OptionReport::ok_or_not_found_field(my_struct.my_field, "my_field")?;
// ...
- added
FrError
- added
SetupError
- added
just printerr <test::uri>
to show the error trace of a given unit test - refactored
bigerror::__field
macro to handle optional methods:my_struct.my_field.as_ref()
Rename OptionReport
methods #7
Breaking change that renames OptionReport
methods:
pub trait OptionReport {
type Some;
- fn ok_or_not_found(self) -> Result<Self::Some, Report<NotFound>>;
- fn ok_or_not_found_kv<K, V>(self, key: K, value: V) -> Result<Self::Some, Report<NotFound>>
+ fn expect_or(self) -> Result<Self::Some, Report<NotFound>>;
+ fn expect_kv<K, V>(self, key: K, value: V) -> Result<Self::Some, Report<NotFound>>
where
K: Display,
V: Display;
- fn ok_or_not_found_field(self, field: &'static str) -> Result<Self::Some, Report<NotFound>>;
- fn ok_or_not_found_by<K: Display>(self, key: K) -> Result<Self::Some, Report<NotFound>>;
+ fn expect_field(self, field: &'static str) -> Result<Self::Some, Report<NotFound>>;
+ fn expect_by<K: Display>(self, key: K) -> Result<Self::Some, Report<NotFound>>;
}
OptionReport::expect_or
was used to avoid namespace conflicts withOption::expect
- This should align it with
expect_*
macros such asbigerror::expect_field!(my_struct.my_field)?;
Introduce typed key/value attachments #8
-
Added
KeyValue
attachment, now used inReportable::with_kv
andAttachExt::attach_kv
:
https://github.com/knox-networks/bigerror/blob/d27dea90f456d382ef678e866de8af77d9519f9e/src/attachment.rs#L18-L27 -
Refactored
Field
attachment:
https://github.com/knox-networks/bigerror/blob/d27dea90f456d382ef678e866de8af77d9519f9e/src/attachment.rs#L30-L37 -
Added
Type
attachment:
https://github.com/knox-networks/bigerror/blob/d27dea90f456d382ef678e866de8af77d9519f9e/src/attachment.rs#L50-L59 -
*_debug
methods renamed to use the*_dbg
shorthand
Add accessor method handling for expect_field!
, ResultIntoContext
trait additions #9
ResultIntoContext
trait:
- added
ResultIntoContext::then_ctx
andResultIntoContext::map_ctx
, equivalent toResult::and_then
andResult::map
for results where the error isReport<impl Reportable>
https://github.com/knox-networks/bigerror/blob/19b176fc03490f80621e6d56de0cb4982d9b5078/src/lib.rs#L128-L138
expect_field!
macro:
- accessor methods can now be treated as fields by prepending the method name with
%
:
https://github.com/knox-networks/bigerror/blob/6892246c8cfa4c6e5247daeba55f10de5635b7cd/src/lib.rs#L986
The above codeblock expands to:bigerror::OptionReport::expect_field(my_struct.my_field(), "my_field")
Added new contexts:
EncodeError
DecodeError
AuthError
InvalidState
- Added
attachment::FromTo
- Added
Reportable::attach_variant
Added LogError::on_err
v0.6.0
Changelog
[0.6.0] - 2024-01-04
InvalidInput::expected_actual
is now a blanket method:Reportable::expected_actual
- added
Reportable::with_variant
- added
Reportable::with_variant_debug
- added
OptionReport::ok_or_not_found_by
- added
Reportable::with_type
- added
attachment::Index
for referencing vec indices and map/db keys OptionReport::ok_or_not_found_by
now usesattachment::Index
for
the key- added runnable example test case to README documentation
cargo test -- session::test::multi_associated --nocapture
v0.5.0
v0.4.0
Changelog
[0.4.0] - 2023-10-04
-
Introduced
OptionReport
trait#1 -
Intorduced
IntoContext
andReportIntoContext
traits #2 -
Split
src/kind.rs
intosrc/context.rs
andsrc/attachment.rs
-
Removed foreign closure calls that prevented
#[track_caller]
-
Added
impl<C> ToReport<C> for Report<C>
-
Added
attachment::Unsupported
-
Added
attachment::Field
-
Added
Reportable::with_field_status
-
ReportAs
now implemented for&str
andString
-
Attachment keys are now generic
-
Added
BoxCoreError
to satisfycore::error::Error
trait -
impl<T, E: Context> ReportAs<T> for Result<T, E>
now usesReport::attach_printable
v0.3.0
Changelog
[0.3.0] - 2023-05-30
-
Create
rust.yml
for CI -
Added unit tests
-
Added
cliff.toml
-
Added
bigerror::init_colour()
andbigerror::init_emphasis
-
Updated with no ansi
-
Redundant comment removed
-
Removed constraint
-
Added
ToErrReport
trait -
Added
BoxError
type to handleBox<dyn std::error::Error>
-
README.md
example now compiles
v0.2.0
Changelog
[0.2.0] - 2023-05-26
- Added
BuildError
- Added
InvalidInput::expected_actual
- Added
InvalidInput::type_name
- Added
LogError::and_log
- Added
ReportAs
trait - Added
Reportable::report_inner
- Added
Reportable::report_with_kv
- Added
Reportable::with_kv_debug
- Added
ReportableExt
- Added cargo license
- Fixed missing field display
- Made
MissingField
an attachment forNotFound::with_field
(was previously an extraFrame
) - Reexport
error_stack
ConversionError
now takes generics