Skip to content

Commit b748022

Browse files
committed
improve description of emulator grpc error code mapping const
1 parent f2c305a commit b748022

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/data-connect/data-connect-api-client-internal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
FirebaseDataConnectError,
2626
DataConnectErrorCode,
2727
DATA_CONNECT_ERROR_CODE_MAPPING,
28-
GRPC_STATUS_CODE_TO_STRING
28+
EMULATOR_GRPC_STATUS_CODE_TO_STRING
2929
} from './error';
3030
import * as utils from '../utils/index';
3131
import * as validator from '../utils/validator';
@@ -421,7 +421,7 @@ export class DataConnectApiClient {
421421

422422
let status = error.status;
423423
if (!status && validator.isNumber(error.code)) {
424-
status = GRPC_STATUS_CODE_TO_STRING[error.code as number];
424+
status = EMULATOR_GRPC_STATUS_CODE_TO_STRING[error.code as number];
425425
}
426426

427427
let code: DataConnectErrorCode = DATA_CONNECT_ERROR_CODE_MAPPING.UNKNOWN;

src/data-connect/error.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ export class FirebaseDataConnectError extends FirebaseError {
7171
}
7272

7373
/**
74-
* Mappings from gRPC status codes to their string equivalents.
74+
* Mappings from gRPC status codes to their string equivalents. Used to convert
75+
* error codes from the emulator into the codes and statuses matching errors
76+
* from production.
7577
* @internal
7678
*/
77-
export const GRPC_STATUS_CODE_TO_STRING: Record<number, string> = {
79+
export const EMULATOR_GRPC_STATUS_CODE_TO_STRING: Record<number, string> = {
7880
1: 'CANCELLED',
7981
2: 'UNKNOWN',
8082
3: 'INVALID_ARGUMENT',

0 commit comments

Comments
 (0)