Trait frame_support::weights::WithPostDispatchInfo[][src]

pub trait WithPostDispatchInfo {
    fn with_weight(self, actual_weight: Weight) -> DispatchErrorWithPostInfo;
}

Allows easy conversion from DispatchError to DispatchErrorWithPostInfo for dispatchables that want to return a custom a posterior weight on error.

Required methods

fn with_weight(self, actual_weight: Weight) -> DispatchErrorWithPostInfo[src]

Call this on your modules custom errors type in order to return a custom weight on error.

Example

let who = ensure_signed(origin).map_err(|e| e.with_weight(100))?;
ensure!(who == me, Error::<T>::NotMe.with_weight(200_000));
Loading content...

Implementors

impl<T> WithPostDispatchInfo for T where
    T: Into<DispatchError>, 
[src]

Loading content...