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

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

Required Methods§

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(Weight::from_ref_time(100)))?;
ensure!(who == me, Error::<T>::NotMe.with_weight(200_000));

Implementors§