Skip to content

Commit

Permalink
Surface the error for COUNT queries (#7072)
Browse files Browse the repository at this point in the history
* Surface the error for COUNT queries

This is necessary for errors where an index needs to be created and the user needs the creation link

* Update index.console.ts

* fix formatting
  • Loading branch information
qtz1 committed Mar 6, 2023
1 parent 5ba5243 commit 547348b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/firestore-compat/src/index.console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,13 @@ export class Firestore extends FirestoreCompat {
INTERNAL = {
delete: () => this.terminate(),
count: (query: Compat<ExpQuery<unknown>>) => {
return getCountFromServer(query._delegate).then(response => {
return response.data().count;
});
return getCountFromServer(query._delegate)
.then(response => {
return response.data().count;
})
.catch(error => {
throw new FirestoreError(error.code, error.message);
});
}
};
}
Expand Down

0 comments on commit 547348b

Please sign in to comment.