pub fn assert_json_rpc_error(
response: &JsonRpcResponse,
expected_code: Option<i32>,
)Expand description
Validates that a JSON-RPC response indicates an error.
§Arguments
response- The response to validateexpected_code- Optional expected error code
§Panics
Panics if the response is successful or has wrong error code.
§Example
ⓘ
let response = JsonRpcResponse::error(
Some(RequestId::Number(1)),
McpError::method_not_found("unknown").into(),
);
assert_json_rpc_error(&response, Some(-32601));