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

pub trait WithPostDispatchInfo {
    pub 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

pub fn with_weight(self, actual_weight: Weight) -> DispatchErrorWithPostInfo

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


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


impl<T> WithPostDispatchInfo for T where
    T: Into<DispatchError>, 

Loading content...