pub trait ResultLiquidExt<T> where
    Self: Sized
{ fn trace<S>(self, trace: S) -> Result<T>
    where
        S: Into<KString>
;
fn trace_with<F>(self, trace: F) -> Result<T>
    where
        F: FnOnce() -> KString
;
fn context_key<S>(self, key: S) -> Key<T>
    where
        S: Into<KString>
;
fn context_key_with<F>(self, key: F) -> FnKey<T, F>
    where
        F: FnOnce() -> KString
; }
Expand description

Add context to a crate::error::Error.

Required methods

Add a new stack frame to the crate::error::Error.

Example
use liquid_core::error::Error;
use liquid_core::error::Result;
use liquid_core::error::ResultLiquidExt;

let error: Result<i32> = Err(Error::with_msg("Oops"));
let error = error.trace("Within forloop");

Add a new stack frame to the crate::error::Error.

Example
use liquid_core::error::Error;
use liquid_core::error::Result;
use liquid_core::error::ResultLiquidExt;

let for_var = "foo";
let error: Result<i32> = Err(Error::with_msg("Oops"));
let error = error.trace_with(|| format!("Within forloop with {}", for_var).into());

Add state the current stack frame.

Example
use liquid_core::error::Error;
use liquid_core::error::Result;
use liquid_core::error::ResultLiquidExt;

let for_var = "foo";
let error: Result<i32> = Err(Error::with_msg("Oops"));
let error = error
    .context_key("foo")
    .value("10");
let error = error
    .context_key("foo")
    .value_with(|| format!("{}", for_var).into());

Add state the current stack frame.

Example
use liquid_core::error::Error;
use liquid_core::error::Result;
use liquid_core::error::ResultLiquidExt;

let for_var = "foo";
let error: Result<i32> = Err(Error::with_msg("Oops"));
let error = error
    .context_key_with(|| format!("{}", 10).into())
    .value("10");
let error = error
    .context_key_with(|| format!("{}", 10).into())
    .value_with(|| format!("{}", for_var).into());

Implementors