@@ -24,6 +24,7 @@ import {
2424 getRowResponse ,
2525 getTableInfo ,
2626} from './utils' ;
27+ import { GoogleError } from 'google-gax' ;
2728
2829export const readRow : ClientImplMaker < IReadRowRequest , IRowResult > = ( {
2930 clientMap,
@@ -32,15 +33,27 @@ export const readRow: ClientImplMaker<IReadRowRequest, IRowResult> = ({
3233 const { clientId, rowKey, tableName} = rawRequest . request ;
3334 const columns = { } ;
3435
35- const bigtable = clientMap . get ( clientId ! ) ;
36- const table = getTableInfo ( bigtable , tableName ! ) ;
37- const row = table . row ( rowKey ! ) ;
36+ try {
37+ const bigtable = clientMap . get ( clientId ! ) ;
38+ const table = getTableInfo ( bigtable , tableName ! ) ;
39+ const row = table . row ( rowKey ! ) ;
3840
39- const res = await row . get ( columns ) ;
40- const firstRow = getRowResponse ( res [ 0 ] ) ;
41+ const res = await row . get ( columns ) ;
42+ const firstRow = getRowResponse ( res [ 0 ] ) ;
4143
42- return {
43- status : { code : grpc . status . OK , details : [ ] } ,
44- row : firstRow ,
45- } ;
44+ return {
45+ status : { code : grpc . status . OK , details : [ ] } ,
46+ row : firstRow ,
47+ } ;
48+ } catch ( e ) {
49+ const error = e as GoogleError ;
50+ return {
51+ status : {
52+ code : error . code ,
53+ // e.details must be in an empty array for the test runner to return the status. This is tracked in b/383096533.
54+ details : [ ] ,
55+ message : error . message ,
56+ } ,
57+ } ;
58+ }
4659 } ) ;
0 commit comments