Skip to content

Commit 547348b

Browse files
authored
Surface the error for COUNT queries (#7072)
* 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
1 parent 5ba5243 commit 547348b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/firestore-compat/src/index.console.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,13 @@ export class Firestore extends FirestoreCompat {
105105
INTERNAL = {
106106
delete: () => this.terminate(),
107107
count: (query: Compat<ExpQuery<unknown>>) => {
108-
return getCountFromServer(query._delegate).then(response => {
109-
return response.data().count;
110-
});
108+
return getCountFromServer(query._delegate)
109+
.then(response => {
110+
return response.data().count;
111+
})
112+
.catch(error => {
113+
throw new FirestoreError(error.code, error.message);
114+
});
111115
}
112116
};
113117
}

0 commit comments

Comments
 (0)