Allow pallet::call to return DispatchResult (#8241)

* allow dispatch result

* remove custom error message

* format

* add forgotten UI test

* fix test

* fix tests
This commit is contained in:
Guillaume Thiolliere
2021-03-03 13:14:07 +01:00
committed by GitHub
parent 4de4662480
commit fb8da7ea92
6 changed files with 71 additions and 6 deletions
@@ -0,0 +1,22 @@
#[frame_support::pallet]
mod pallet {
use frame_support::pallet_prelude::Hooks;
use frame_system::pallet_prelude::{BlockNumberFor, OriginFor};
#[pallet::config]
pub trait Config: frame_system::Config {}
#[pallet::pallet]
pub struct Pallet<T>(core::marker::PhantomData<T>);
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
#[pallet::call]
impl<T: Config> Pallet<T> {
fn foo(origin: OriginFor<T>) -> ::DispatchResult { todo!() }
}
}
fn main() {
}
@@ -0,0 +1,5 @@
error: expected `DispatchResultWithPostInfo` or `DispatchResult`
--> $DIR/call_invalid_return.rs:17:35
|
17 | fn foo(origin: OriginFor<T>) -> ::DispatchResult { todo!() }
| ^^