Skip to content

Commit 823a5f5

Browse files
committed
fix: use FirestoreException instead of generic Exception for read-after-write error
1 parent f3ce996 commit 823a5f5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/googleapis_firestore/lib/src/transaction.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ class Transaction {
122122
/// ```
123123
Future<QuerySnapshot<T>> getQuery<T>(Query<T> query) async {
124124
if (_writeBatch != null && _writeBatch._operations.isNotEmpty) {
125-
throw Exception(readAfterWriteErrorMsg);
125+
throw FirestoreException(
126+
FirestoreClientErrorCode.failedPrecondition,
127+
readAfterWriteErrorMsg,
128+
);
126129
}
127130
return _withLazyStartedTransaction<Query<T>, QuerySnapshot<T>>(
128131
query,

0 commit comments

Comments
 (0)