diff --git a/src/error.rs b/src/error.rs index 233f130..3ccff0e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -156,8 +156,11 @@ pub enum Error { /// /// [`MetaMethod`]: crate::MetaMethod MetaMethodTypeError { + /// Name of the metamethod. method: StdString, + /// Passed value type. type_name: &'static str, + /// A string containing more detailed error information. message: Option, }, /// A [`RegistryKey`] produced from a different Lua state was used. @@ -194,7 +197,9 @@ pub enum Error { ExternalError(Arc), /// An error with additional context. WithContext { + /// A string containing additional context. context: StdString, + /// Underlying error. cause: Arc, }, } @@ -399,7 +404,11 @@ where /// Provides the `context` method for [`Error`] and `Result`. pub trait ErrorContext: Sealed { + /// Wraps the error value with additional context. fn context(self, context: C) -> Self; + + /// Wrap the error value with additional context that is evaluated lazily + /// only once an error does occur. fn with_context(self, f: impl FnOnce(&Error) -> C) -> Self; }