Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schmidt-sebastian/ebb63b96c048f3c43187edac7523f9c4 to your computer and use it in GitHub Desktop.
Save schmidt-sebastian/ebb63b96c048f3c43187edac7523f9c4 to your computer and use it in GitHub Desktop.
diff --git a/dev/src/bulk-writer.ts b/dev/src/bulk-writer.ts
index e4f4ca7..cf2e930 100644
--- a/dev/src/bulk-writer.ts
+++ b/dev/src/bulk-writer.ts
@@ -40,9 +40,6 @@ import {
validateInteger,
validateOptional,
} from './validate';
-// TODO: How do I get rid of this?
-// eslint-disable-next-line no-undef
-import GrpcStatus = FirebaseFirestore.GrpcStatus;
/*!
* The maximum number of writes that can be in a single batch.
@@ -331,8 +328,8 @@ class BulkCommitBatch {
} else if (!allowRetry || !this.shouldRetry(result.status.code)) {
const error = new BulkWriterError(
op.operation,
- (result.status.code as unknown) as GrpcStatus,
- result.status.message
+ result.status.message,
+ result.status.code
);
op.deferred.reject(error);
} else {
@@ -403,8 +400,8 @@ export class BulkWriterError extends Error {
/** @hideconstructor */
constructor(
readonly operation: BulkWriterOperation,
- readonly code: GrpcStatus,
- readonly message: string
+ readonly message: string,
+ readonly code: Status = Status.UNKNOWN
) {
super(message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment