Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add @throws API comment for CRUD methods #5827

Merged
merged 1 commit into from Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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