diff --git a/src/tabular-api-surface.ts b/src/tabular-api-surface.ts index 3e66e42e1..24c7020c9 100644 --- a/src/tabular-api-surface.ts +++ b/src/tabular-api-surface.ts @@ -29,7 +29,7 @@ import {Row} from './row'; import {ChunkTransformer} from './chunktransformer'; import {BackoffSettings} from 'google-gax/build/src/gax'; import {google} from '../protos/protos'; -import {CallOptions, ServiceError} from 'google-gax'; +import {CallOptions, grpc, ServiceError} from 'google-gax'; import {Duplex, PassThrough, Transform} from 'stream'; import * as is from 'is'; import {GoogleInnerError} from './table'; @@ -480,6 +480,19 @@ Please use the format 'prezzy' or '${instance.name}/tables/prezzy'.`); ); retryTimer = setTimeout(makeNewRequest, nextRetryDelay); } else { + if ( + !error.code && + error.message === 'The client has already been closed.' + ) { + // + // The TestReadRows_Generic_CloseClient conformance test requires + // a grpc code to be present when the client is closed. According + // to Gemini, the appropriate code for a closed client is + // CANCELLED since the user actually cancelled the call by closing + // the client. + // + error.code = grpc.status.CANCELLED; + } userStream.emit('error', error); } }) diff --git a/testproxy/services/close-client.js b/testproxy/services/close-client.js index 54eebf52a..f836512e3 100644 --- a/testproxy/services/close-client.js +++ b/testproxy/services/close-client.js @@ -24,7 +24,7 @@ const closeClient = ({clientMap}) => const bigtable = clientMap.get(clientId); if (bigtable) { - await bigtable[v2].close(); + // await bigtable[v2].close(); await bigtable.close(); return {}; }