MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / context

Method context

crates/core/src/error/error.rs:740–752  ·  view source on GitHub ↗

Add additional context to this error. The new context will show up first in the error chain, and the original error will come next. This is similar to the [`Context::context`] trait method, but because it is a method directly on [`Error`], there is no need for lazily-computing the error context (like `with_context` does). Calling [`error.is:: ()`](Error::is) will return `true` for the new err

(self, context: C)

Source from the content-addressed store, hash-verified

738 /// );
739 /// ```
740 pub fn context<C>(self, context: C) -> Self
741 where
742 C: fmt::Display + Send + Sync + 'static,
743 {
744 if self.inner.is_oom() {
745 self
746 } else {
747 Self::from_error_ext(ContextError {
748 context,
749 error: Some(self),
750 })
751 }
752 }
753
754 #[inline]
755 pub(crate) fn from_error_ext(error: impl ErrorExt) -> Self {

Callers 15

into_boxed_dyn_errorFunction · 0.45
isFunction · 0.45
backtraceFunction · 0.45
downcastFunction · 0.45
downcast_refFunction · 0.45
downcast_mutFunction · 0.45
context_on_oomFunction · 0.45
context_on_ok_resultFunction · 0.45
context_on_err_resultFunction · 0.45
context_on_some_optionFunction · 0.45
context_on_none_optionFunction · 0.45

Calls 1

is_oomMethod · 0.45

Tested by 15

into_boxed_dyn_errorFunction · 0.36
isFunction · 0.36
backtraceFunction · 0.36
downcastFunction · 0.36
downcast_refFunction · 0.36
downcast_mutFunction · 0.36
context_on_oomFunction · 0.36
context_on_ok_resultFunction · 0.36
context_on_err_resultFunction · 0.36
context_on_some_optionFunction · 0.36
context_on_none_optionFunction · 0.36