Skip to content

Commit c61018e

Browse files
authored
Include ToString() in Firestore's Query::Comparator() assertion failure message (#9489)
1 parent bffb108 commit c61018e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Firestore/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Unreleased
2+
- [changed] Add more details to the assertion failure in Query::Comparator() to
3+
help with future debugging (#9258).
4+
15
# v8.14.0
26
- [fixed] Fixed compiler warnings in `local_serializer.cc` about "implicit
37
conversion loses integer precision" that were introduced in 8.13.0 (#9430).

Firestore/core/src/core/query.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,10 @@ model::DocumentComparator Query::Comparator() const {
279279
break;
280280
}
281281
}
282-
HARD_ASSERT(has_key_ordering,
283-
"QueryComparator needs to have a key ordering.");
282+
283+
if (!has_key_ordering) {
284+
HARD_FAIL("QueryComparator needs to have a key ordering: %s", ToString());
285+
}
284286

285287
return DocumentComparator(
286288
[ordering](const Document& doc1, const Document& doc2) {

0 commit comments

Comments
 (0)