Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add solution hint to error message #13111

Merged
merged 6 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add solution hint to error message
  • Loading branch information
alexgparity committed Jan 10, 2023
commit 4e3db04aea7b590033ecae81ba1e39a4f16574e8
2 changes: 1 addition & 1 deletion frame/support/procedural/src/pallet/expand/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
<T as #frame_system::Config>::PalletInfo
as
#frame_support::traits::PalletInfo
>::name::<Self>().expect("Every active pallet has a name in the runtime; qed");
>::name::<Self>().expect("Every active pallet has a name in the runtime; qed. Have you added the pallet into construct_runtime! ?");
#frame_support::log::debug!(
target: #frame_support::LOG_TARGET,
"🩺 try-state pallet {:?}",
Expand Down
8 changes: 5 additions & 3 deletions frame/support/procedural/src/pallet/expand/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream {
let frame_system = &def.frame_system;
let pallet_ident = &def.pallet_struct.pallet;

let err_msg = "Every active pallet has a name in the runtime; qed. Have you added the pallet into construct_runtime! ?";

let entries_builder = def.storages.iter().map(|storage| {
let no_docs = vec![];
let docs = if cfg!(feature = "no-metadata-docs") { &no_docs } else { &storage.docs };
Expand Down Expand Up @@ -535,7 +537,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream {
<T as #frame_system::Config>::PalletInfo
as #frame_support::traits::PalletInfo
>::name::<Pallet<#type_use_gen>>()
.expect("Every active pallet has a name in the runtime; qed")
.expect(err_msg)
}
const STORAGE_PREFIX: &'static str = #counter_prefix_struct_const;
}
Expand Down Expand Up @@ -569,7 +571,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream {
<T as #frame_system::Config>::PalletInfo
as #frame_support::traits::PalletInfo
>::name::<Pallet<#type_use_gen>>()
.expect("Every active pallet has a name in the runtime; qed")
.expect(err_msg)
}
const STORAGE_PREFIX: &'static str = #prefix_struct_const;
}
Expand Down Expand Up @@ -648,7 +650,7 @@ pub fn expand_storages(def: &mut Def) -> proc_macro2::TokenStream {
<T as #frame_system::Config>::PalletInfo as
#frame_support::traits::PalletInfo
>::name::<#pallet_ident<#type_use_gen>>()
.expect("Every active pallet has a name in the runtime; qed"),
.expect(err_msg),
entries: {
#[allow(unused_mut)]
let mut entries = #frame_support::sp_std::vec![];
Expand Down