Skip to content

Commit c2fff0c

Browse files
docs: add @throws API comment for CRUD methods (#5827)
1 parent 9ca74ee commit c2fff0c

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

packages/firestore/src/lite-api/reference_impl.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ export function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>> {
194194
*
195195
* @param reference - A reference to the document to write.
196196
* @param data - A map of the fields and values for the document.
197+
* @throws Error - If the provided input is not a valid Firestore document.
197198
* @returns A `Promise` resolved once the data has been successfully written
198199
* to the backend.
199200
*/
@@ -214,6 +215,7 @@ export function setDoc<T>(
214215
* @param reference - A reference to the document to write.
215216
* @param data - A map of the fields and values for the document.
216217
* @param options - An object to configure the set behavior.
218+
* @throws Error - If the provided input is not a valid Firestore document.
217219
* @returns A `Promise` resolved once the data has been successfully written
218220
* to the backend.
219221
*/
@@ -263,6 +265,7 @@ export function setDoc<T>(
263265
* @param data - An object containing the fields and values with which to
264266
* update the document. Fields can contain dots to reference nested fields
265267
* within the document.
268+
* @throws Error - If the provided input is not valid Firestore data.
266269
* @returns A `Promise` resolved once the data has been successfully written
267270
* to the backend.
268271
*/
@@ -287,6 +290,7 @@ export function updateDoc<T>(
287290
* @param field - The first field to update.
288291
* @param value - The first value.
289292
* @param moreFieldsAndValues - Additional key value pairs.
293+
* @throws Error - If the provided input is not valid Firestore data.
290294
* @returns A `Promise` resolved once the data has been successfully written
291295
* to the backend.
292296
*/
@@ -370,6 +374,7 @@ export function deleteDoc(
370374
*
371375
* @param reference - A reference to the collection to add this document to.
372376
* @param data - An Object containing the data for the new document.
377+
* @throws Error - If the provided input is not a valid Firestore document.
373378
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
374379
* newly created document after it has been written to the backend.
375380
*/

packages/firestore/src/lite-api/transaction.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export class Transaction {
118118
*
119119
* @param documentRef - A reference to the document to be set.
120120
* @param data - An object of the fields and values for the document.
121+
* @throws Error - If the provided input is not a valid Firestore document.
121122
* @returns This `Transaction` instance. Used for chaining method calls.
122123
*/
123124
set<T>(documentRef: DocumentReference<T>, data: WithFieldValue<T>): this;
@@ -130,6 +131,7 @@ export class Transaction {
130131
* @param documentRef - A reference to the document to be set.
131132
* @param data - An object of the fields and values for the document.
132133
* @param options - An object to configure the set behavior.
134+
* @throws Error - If the provided input is not a valid Firestore document.
133135
* @returns This `Transaction` instance. Used for chaining method calls.
134136
*/
135137
set<T>(
@@ -169,6 +171,7 @@ export class Transaction {
169171
* @param data - An object containing the fields and values with which to
170172
* update the document. Fields can contain dots to reference nested fields
171173
* within the document.
174+
* @throws Error - If the provided input is not valid Firestore data.
172175
* @returns This `Transaction` instance. Used for chaining method calls.
173176
*/
174177
update<T>(documentRef: DocumentReference<T>, data: UpdateData<T>): this;
@@ -184,6 +187,7 @@ export class Transaction {
184187
* @param field - The first field to update.
185188
* @param value - The first value.
186189
* @param moreFieldsAndValues - Additional key/value pairs.
190+
* @throws Error - If the provided input is not valid Firestore data.
187191
* @returns This `Transaction` instance. Used for chaining method calls.
188192
*/
189193
update(

packages/firestore/src/lite-api/write_batch.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export class WriteBatch {
8686
* @param documentRef - A reference to the document to be set.
8787
* @param data - An object of the fields and values for the document.
8888
* @param options - An object to configure the set behavior.
89+
* @throws Error - If the provided input is not a valid Firestore document.
8990
* @returns This `WriteBatch` instance. Used for chaining method calls.
9091
*/
9192
set<T>(
@@ -127,6 +128,7 @@ export class WriteBatch {
127128
* @param data - An object containing the fields and values with which to
128129
* update the document. Fields can contain dots to reference nested fields
129130
* within the document.
131+
* @throws Error - If the provided input is not valid Firestore data.
130132
* @returns This `WriteBatch` instance. Used for chaining method calls.
131133
*/
132134
update<T>(documentRef: DocumentReference<T>, data: UpdateData<T>): WriteBatch;
@@ -142,6 +144,7 @@ export class WriteBatch {
142144
* @param field - The first field to update.
143145
* @param value - The first value.
144146
* @param moreFieldsAndValues - Additional key value pairs.
147+
* @throws Error - If the provided input is not valid Firestore data.
145148
* @returns This `WriteBatch` instance. Used for chaining method calls.
146149
*/
147150
update(

0 commit comments

Comments
 (0)