Skip to content

v0.7.0

Compare
Choose a tag to compare
@mkatychev mkatychev released this 27 Mar 18:52
· 30 commits to main since this release
7e25fac

Changelog

[0.7.0] - 2024-03-27

  • Added context::Timeout
  • Added attachment::DisplayDuration
  • Added Reportable::with_type_status
  • Added ClearResult trait for mapping Ok(T) -> Ok(()) and Err(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 with Option::expect
  • This should align it with expect_* macros such as bigerror::expect_field!(my_struct.my_field)?;

Introduce typed key/value attachments #8


Add accessor method handling for expect_field!, ResultIntoContext trait additions #9

ResultIntoContext trait:


expect_field! macro:


Added new contexts:

  • EncodeError
  • DecodeError
  • AuthError
  • InvalidState

  • Added attachment::FromTo
  • Added Reportable::attach_variant
  • Added LogError::on_err