Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code space information in unknown SDK error #2268

Merged
merged 1 commit into from
Jun 13, 2022
Merged
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
15 changes: 12 additions & 3 deletions relayer/src/sdk_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ define_error! {
|_| { "Expected error code, instead got Ok" },

UnknownSdk
{
codespace: String,
code: u32,
}
| e | {
format_args!("unknown SDK error with code space: {}, code: {}", e.codespace, e.code)
},

UnknownTxSync
{ code: u32 }
|e| { format!("unknown SDK error: {}", e.code) },
| e | { format_args!("unknown TX sync response error: {}", e.code) },

OutOfGas
{ code: u32 }
Expand Down Expand Up @@ -169,7 +178,7 @@ pub fn sdk_error_from_tx_result(result: &TxResult) -> SdkError {
SdkError::client(client_error_from_code(code))
} else {
// TODO: Implement mapping for other codespaces in ibc-go
SdkError::unknown_sdk(code)
SdkError::unknown_sdk(codespace, code)
}
}
}
Expand All @@ -186,6 +195,6 @@ pub fn sdk_error_from_tx_sync_error_code(code: u32) -> SdkError {
// on the Hermes side. We'll inform the user to check for misconfig.
11 => SdkError::out_of_gas(code),
13 => SdkError::insufficient_fee(code),
_ => SdkError::unknown_sdk(code),
_ => SdkError::unknown_tx_sync(code),
}
}