diff --git a/src/util/error.rs b/src/util/error.rs index 663dab8..c3e5b25 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -233,6 +233,13 @@ impl> Contextualize> for Result { } } +impl Contextualize> for Option { + #[track_caller] + fn err_context(self, context: impl Into) -> Result { + self.ok_or(Error::new_here(ErrorType::Error(context.into()))) + } +} + impl> Contextualize for E { #[track_caller] fn err_context(self, context: impl Into) -> Error {