Better error handling in sharding test.
Improve error handling in HTTP requests for sharding.