File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed
Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,9 @@ pub enum RuntimeError {
9999 /// Module error.
100100 #[ error( "Runtime module error: {0}" ) ]
101101 Module ( ModuleError ) ,
102+ /// Module error and the error is not found in metadata.
103+ #[ error( "Runtime module error (missing metadata): {0}" ) ]
104+ ModuleMissingMetadata ( ModuleError ) ,
102105 /// At least one consumer is remaining so the account cannot be destroyed.
103106 #[ error( "At least one consumer is remaining so the account cannot be destroyed." ) ]
104107 ConsumerRemaining ,
@@ -129,11 +132,20 @@ impl RuntimeError {
129132 message : _,
130133 } => {
131134 let module = metadata. module_with_errors ( index) ?;
132- let error = module. error ( error) ?;
133- Ok ( Self :: Module ( ModuleError {
134- module : module. name ( ) . to_string ( ) ,
135- error : error. to_string ( ) ,
136- } ) )
135+ match module. error ( error) {
136+ Ok ( e) => {
137+ Ok ( Self :: Module ( ModuleError {
138+ module : module. name ( ) . to_string ( ) ,
139+ error : e. to_string ( ) ,
140+ } ) )
141+ }
142+ Err ( e) => {
143+ Ok ( Self :: ModuleMissingMetadata ( ModuleError {
144+ module : module. name ( ) . to_string ( ) ,
145+ error : e. to_string ( ) ,
146+ } ) )
147+ }
148+ }
137149 }
138150 DispatchError :: BadOrigin => Ok ( Self :: BadOrigin ) ,
139151 DispatchError :: CannotLookup => Ok ( Self :: CannotLookup ) ,
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ pub enum MetadataError {
5858 /// Event is not in metadata.
5959 #[ error( "Event {0} not found" ) ]
6060 EventNotFound ( u8 ) ,
61- /// Event is not in metadata.
61+ /// Error is not in metadata.
6262 #[ error( "Error {0} not found" ) ]
6363 ErrorNotFound ( u8 ) ,
6464 /// Storage is not in metadata.
You can’t perform that action at this time.
0 commit comments