firebase / firebase/firebase-admin-node

[Firestore] What is the recommended way to check for an instance of a Firestore error using this package?

Offen
#2,257 11 Kommentare 1 Reaktion 1 zugewiesene Person Beansprucht von @ehsannas Auf GitHub ansehen
api: firestore
Vorherrschende Sprache
TypeScript
Sterne
1.7k
Forks
419
Ø Merge
3 T. 10 Std.
Gemergte PRs (30 T.)
16

Beschreibung

Using `firebase-admin`, what is the recommended way to verify an error is Firestore related? And so that typescript knows that the error instance will have the `code` property, etc?

Ideally, I'd be able to verify the error is an instance of [`FirestoreError`](https://firebase.google.com/docs/reference/node/firebase.firestore.FirestoreError), but the error I'm experiencing now seems to be grpc related, as the `code` property is returning a number corresponding to the errors [here](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md).

There [are](https://github.com/firebase/firebase-admin-node/issues/1666) [several](https://github.com/firebase/firebase-admin-node/issues/1741) [issues](https://github.com/firebase/firebase-admin-node/pull/2151) in this repository around getting access to error classes, with no clear answers.

If I'm missing something, please point me in the right direction.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.