Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 17 additions & 5 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ pub enum RuntimeError {
/// Module error.
#[error("Runtime module error: {0}")]
Module(ModuleError),
/// Module error and the error is not found in metadata.
#[error("Runtime module error (missing metadata): {0}")]
ModuleMissingMetadata(ModuleError),
/// At least one consumer is remaining so the account cannot be destroyed.
#[error("At least one consumer is remaining so the account cannot be destroyed.")]
ConsumerRemaining,
Expand Down Expand Up @@ -129,11 +132,20 @@ impl RuntimeError {
message: _,
} => {
let module = metadata.module_with_errors(index)?;
let error = module.error(error)?;
Ok(Self::Module(ModuleError {
module: module.name().to_string(),
error: error.to_string(),
}))
match module.error(error) {
Ok(e) => {
Ok(Self::Module(ModuleError {
module: module.name().to_string(),
error: e.to_string(),
}))
}
Err(e) => {
Ok(Self::ModuleMissingMetadata(ModuleError {
module: module.name().to_string(),
error: e.to_string(),
}))
}
}
}
DispatchError::BadOrigin => Ok(Self::BadOrigin),
DispatchError::CannotLookup => Ok(Self::CannotLookup),
Expand Down
2 changes: 1 addition & 1 deletion src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub enum MetadataError {
/// Event is not in metadata.
#[error("Event {0} not found")]
EventNotFound(u8),
/// Event is not in metadata.
/// Error is not in metadata.
#[error("Error {0} not found")]
ErrorNotFound(u8),
/// Storage is not in metadata.
Expand Down