Skip to content

Commit

Permalink
RPC: Improve unsupported transaction error message (#28249)
Browse files Browse the repository at this point in the history
(cherry picked from commit db37d6b)
  • Loading branch information
jstarry authored and mergify[bot] committed Oct 6, 2022
1 parent f43352b commit bbae69c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion client/src/rpc_custom_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@ impl From<RpcCustomError> for Error {
},
RpcCustomError::UnsupportedTransactionVersion(version) => Self {
code: ErrorCode::ServerError(JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION),
message: format!("Transaction version ({}) is not supported", version),
message: format!(
"Transaction version ({0}) is not supported by the requesting client. \
Please try the request again with the following configuration parameter: \
\"maxSupportedTransactionVersion\": {0}",
version
),
data: None,
},
RpcCustomError::MinContextSlotNotReached { context_slot } => Self {
Expand Down
6 changes: 5 additions & 1 deletion rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6634,7 +6634,11 @@ pub mod tests {
let response = parse_failure_response(rpc.handle_request_sync(request));
let expected = (
JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION,
String::from("Transaction version (0) is not supported"),
String::from(
"Transaction version (0) is not supported by the requesting client. \
Please try the request again with the following configuration parameter: \
\"maxSupportedTransactionVersion\": 0",
),
);
assert_eq!(response, expected);
}
Expand Down

0 comments on commit bbae69c

Please sign in to comment.