Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

RPC: Improve unsupported transaction error message #28249

Merged
merged 1 commit into from
Oct 6, 2022
Merged
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
7 changes: 6 additions & 1 deletion rpc-client-api/src/custom_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,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 @@ -6753,7 +6753,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