[chronik-client] Switch to next server if we cannot decode a chronik server error per chronik server error proto
Summary:
In production, seeing instances where valid chronik queries may return unparseable errors if the server is re-indexing. In this case, we want to try a different server. But right now, chronik-client only recognizes the need to try a different server if the server is unreachable.
The unreachable server case is distinguished by 'code' in err. We add a new filter for "try another server" -- if we are unable to decode the error msg returned by the server according to chronik's proto.
If we can't parse the error, it's not a defined chronik error, and there is something wrong with the server.
Test Plan:
Install locally and test the following queries on an indexing server, e.g. 'https://chronik-native1.fabien.cash'
- query for chronik.block(856498) with chronik-native1 as first server and no second server, no response, error
- query for chronik.block(856498) with chronik-native1 as first server and chronik-native2 as second server, get response as failoverProxy cycles to next server
- query for chronik.block('test') with chronik-native1 as first server and no second server, we get "error connecting to known chronik instances" as the indexing server does not return the proper error msg
- query chronik.block('test') with chronik-native1 as the first server and chronik-native2 as second server, get expected error "Error in printBlock Error: Failed getting /block/test (): 400: Not a hash or height: test" (confirming that we cycled to the good server with a bad query to a bad server).
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D16584