And since batched method expects Vec\<Output> as a result, serde_json fails to parse response and returns generic and obfuscated error like failed to deserialize response: invalid type: map, expected a sequence at line 1 column 0
Solution:
Check for json-rpc error object before parsing response as array of outputs and returns appropriate Rpc error. Test to reproduce the issue and verify the fix is added.
Situation: Some public nodes on various chains reply with the following json body for batched requests:
And since batched method expects Vec\<Output> as a result, serde_json fails to parse response and returns generic and obfuscated error like
failed to deserialize response: invalid type: map, expected a sequence at line 1 column 0
Solution: Check for json-rpc error object before parsing response as array of outputs and returns appropriate Rpc error. Test to reproduce the issue and verify the fix is added.