Skip to content

Commit

Permalink
docs: add @throws API comment for CRUD methods (#5827)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian committed Dec 22, 2021
1 parent 9ca74ee commit c2fff0c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/firestore/src/lite-api/reference_impl.ts
Expand Up @@ -194,6 +194,7 @@ export function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>> {
*
* @param reference - A reference to the document to write.
* @param data - A map of the fields and values for the document.
* @throws Error - If the provided input is not a valid Firestore document.
* @returns A `Promise` resolved once the data has been successfully written
* to the backend.
*/
Expand All @@ -214,6 +215,7 @@ export function setDoc<T>(
* @param reference - A reference to the document to write.
* @param data - A map of the fields and values for the document.
* @param options - An object to configure the set behavior.
* @throws Error - If the provided input is not a valid Firestore document.
* @returns A `Promise` resolved once the data has been successfully written
* to the backend.
*/
Expand Down Expand Up @@ -263,6 +265,7 @@ export function setDoc<T>(
* @param data - An object containing the fields and values with which to
* update the document. Fields can contain dots to reference nested fields
* within the document.
* @throws Error - If the provided input is not valid Firestore data.
* @returns A `Promise` resolved once the data has been successfully written
* to the backend.
*/
Expand All @@ -287,6 +290,7 @@ export function updateDoc<T>(
* @param field - The first field to update.
* @param value - The first value.
* @param moreFieldsAndValues - Additional key value pairs.
* @throws Error - If the provided input is not valid Firestore data.
* @returns A `Promise` resolved once the data has been successfully written
* to the backend.
*/
Expand Down Expand Up @@ -370,6 +374,7 @@ export function deleteDoc(
*
* @param reference - A reference to the collection to add this document to.
* @param data - An Object containing the data for the new document.
* @throws Error - If the provided input is not a valid Firestore document.
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
* newly created document after it has been written to the backend.
*/
Expand Down
4 changes: 4 additions & 0 deletions packages/firestore/src/lite-api/transaction.ts
Expand Up @@ -118,6 +118,7 @@ export class Transaction {
*
* @param documentRef - A reference to the document to be set.
* @param data - An object of the fields and values for the document.
* @throws Error - If the provided input is not a valid Firestore document.
* @returns This `Transaction` instance. Used for chaining method calls.
*/
set<T>(documentRef: DocumentReference<T>, data: WithFieldValue<T>): this;
Expand All @@ -130,6 +131,7 @@ export class Transaction {
* @param documentRef - A reference to the document to be set.
* @param data - An object of the fields and values for the document.
* @param options - An object to configure the set behavior.
* @throws Error - If the provided input is not a valid Firestore document.
* @returns This `Transaction` instance. Used for chaining method calls.
*/
set<T>(
Expand Down Expand Up @@ -169,6 +171,7 @@ export class Transaction {
* @param data - An object containing the fields and values with which to
* update the document. Fields can contain dots to reference nested fields
* within the document.
* @throws Error - If the provided input is not valid Firestore data.
* @returns This `Transaction` instance. Used for chaining method calls.
*/
update<T>(documentRef: DocumentReference<T>, data: UpdateData<T>): this;
Expand All @@ -184,6 +187,7 @@ export class Transaction {
* @param field - The first field to update.
* @param value - The first value.
* @param moreFieldsAndValues - Additional key/value pairs.
* @throws Error - If the provided input is not valid Firestore data.
* @returns This `Transaction` instance. Used for chaining method calls.
*/
update(
Expand Down
3 changes: 3 additions & 0 deletions packages/firestore/src/lite-api/write_batch.ts
Expand Up @@ -86,6 +86,7 @@ export class WriteBatch {
* @param documentRef - A reference to the document to be set.
* @param data - An object of the fields and values for the document.
* @param options - An object to configure the set behavior.
* @throws Error - If the provided input is not a valid Firestore document.
* @returns This `WriteBatch` instance. Used for chaining method calls.
*/
set<T>(
Expand Down Expand Up @@ -127,6 +128,7 @@ export class WriteBatch {
* @param data - An object containing the fields and values with which to
* update the document. Fields can contain dots to reference nested fields
* within the document.
* @throws Error - If the provided input is not valid Firestore data.
* @returns This `WriteBatch` instance. Used for chaining method calls.
*/
update<T>(documentRef: DocumentReference<T>, data: UpdateData<T>): WriteBatch;
Expand All @@ -142,6 +144,7 @@ export class WriteBatch {
* @param field - The first field to update.
* @param value - The first value.
* @param moreFieldsAndValues - Additional key value pairs.
* @throws Error - If the provided input is not valid Firestore data.
* @returns This `WriteBatch` instance. Used for chaining method calls.
*/
update(
Expand Down

0 comments on commit c2fff0c

Please sign in to comment.