handleBatch only accumulated len(resp.Result) when evaluating the
configured batchResponseMaxSize. Error responses leave Result nil and
put their payload on resp.Error, so a batch returning many errors -
especially ones carrying large error.data via rpc.DataError - could
exceed the limit without ever tripping the response-too-large guard.
Introduce a responseSize helper that returns the marshalled size of
resp.Error when present, so error payloads count toward the cap on the
same footing as successful results. The helper falls back to the error
message length on the (theoretically impossible) case where marshalling
jsonError fails, so the counter still makes progress.
Adds TestServerBatchResponseSizeLimitErrors which configures a 50-byte
cap, issues a batch of five test_returnError calls, and asserts that
only the first error is delivered while the remainder return code
-32003 (errcodeResponseTooLarge). The test fails on master without the
fix and passes with it.
Fixes#33814