[−][src]Trait frame_support::weights::WithPostDispatchInfo
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
Call this on your modules custom errors type in order to return a custom weight on error.
Example
ⓘ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));
Implementors
impl<T> WithPostDispatchInfo for T where
T: Into<DispatchError>,
[src]
T: Into<DispatchError>,