@@ -297,15 +297,19 @@ export class Firestore
297297 collection ( this . _delegate , pathString )
298298 ) ;
299299 } catch ( e ) {
300- throw replaceFunctionName ( e , 'collection()' , 'Firestore.collection()' ) ;
300+ throw replaceFunctionName (
301+ e as Error ,
302+ 'collection()' ,
303+ 'Firestore.collection()'
304+ ) ;
301305 }
302306 }
303307
304308 doc ( pathString : string ) : PublicDocumentReference {
305309 try {
306310 return new DocumentReference ( this , doc ( this . _delegate , pathString ) ) ;
307311 } catch ( e ) {
308- throw replaceFunctionName ( e , 'doc()' , 'Firestore.doc()' ) ;
312+ throw replaceFunctionName ( e as Error , 'doc()' , 'Firestore.doc()' ) ;
309313 }
310314 }
311315
@@ -314,7 +318,7 @@ export class Firestore
314318 return new Query ( this , collectionGroup ( this . _delegate , collectionId ) ) ;
315319 } catch ( e ) {
316320 throw replaceFunctionName (
317- e ,
321+ e as Error ,
318322 'collectionGroup()' ,
319323 'Firestore.collectionGroup()'
320324 ) ;
@@ -687,7 +691,7 @@ export class DocumentReference<T = PublicDocumentData>
687691 ) ;
688692 } catch ( e ) {
689693 throw replaceFunctionName (
690- e ,
694+ e as Error ,
691695 'collection()' ,
692696 'DocumentReference.collection()'
693697 ) ;
@@ -718,7 +722,11 @@ export class DocumentReference<T = PublicDocumentData>
718722 return setDoc ( this . _delegate , value as WithFieldValue < T > ) ;
719723 }
720724 } catch ( e ) {
721- throw replaceFunctionName ( e , 'setDoc()' , 'DocumentReference.set()' ) ;
725+ throw replaceFunctionName (
726+ e as Error ,
727+ 'setDoc()' ,
728+ 'DocumentReference.set()'
729+ ) ;
722730 }
723731 }
724732
@@ -745,7 +753,11 @@ export class DocumentReference<T = PublicDocumentData>
745753 ) ;
746754 }
747755 } catch ( e ) {
748- throw replaceFunctionName ( e , 'updateDoc()' , 'DocumentReference.update()' ) ;
756+ throw replaceFunctionName (
757+ e as Error ,
758+ 'updateDoc()' ,
759+ 'DocumentReference.update()'
760+ ) ;
749761 }
750762 }
751763
@@ -991,7 +1003,11 @@ export class Query<T = PublicDocumentData>
9911003 query ( this . _delegate , where ( fieldPath as string , opStr , value ) )
9921004 ) ;
9931005 } catch ( e ) {
994- throw replaceFunctionName ( e , / ( o r d e r B y | w h e r e ) \( \) / , 'Query.$1()' ) ;
1006+ throw replaceFunctionName (
1007+ e as Error ,
1008+ / ( o r d e r B y | w h e r e ) \( \) / ,
1009+ 'Query.$1()'
1010+ ) ;
9951011 }
9961012 }
9971013
@@ -1008,15 +1024,19 @@ export class Query<T = PublicDocumentData>
10081024 query ( this . _delegate , orderBy ( fieldPath as string , directionStr ) )
10091025 ) ;
10101026 } catch ( e ) {
1011- throw replaceFunctionName ( e , / ( o r d e r B y | w h e r e ) \( \) / , 'Query.$1()' ) ;
1027+ throw replaceFunctionName (
1028+ e as Error ,
1029+ / ( o r d e r B y | w h e r e ) \( \) / ,
1030+ 'Query.$1()'
1031+ ) ;
10121032 }
10131033 }
10141034
10151035 limit ( n : number ) : Query < T > {
10161036 try {
10171037 return new Query < T > ( this . firestore , query ( this . _delegate , limit ( n ) ) ) ;
10181038 } catch ( e ) {
1019- throw replaceFunctionName ( e , 'limit()' , 'Query.limit()' ) ;
1039+ throw replaceFunctionName ( e as Error , 'limit()' , 'Query.limit()' ) ;
10201040 }
10211041 }
10221042
@@ -1027,15 +1047,19 @@ export class Query<T = PublicDocumentData>
10271047 query ( this . _delegate , limitToLast ( n ) )
10281048 ) ;
10291049 } catch ( e ) {
1030- throw replaceFunctionName ( e , 'limitToLast()' , 'Query.limitToLast()' ) ;
1050+ throw replaceFunctionName (
1051+ e as Error ,
1052+ 'limitToLast()' ,
1053+ 'Query.limitToLast()'
1054+ ) ;
10311055 }
10321056 }
10331057
10341058 startAt ( ...args : any [ ] ) : Query < T > {
10351059 try {
10361060 return new Query ( this . firestore , query ( this . _delegate , startAt ( ...args ) ) ) ;
10371061 } catch ( e ) {
1038- throw replaceFunctionName ( e , 'startAt()' , 'Query.startAt()' ) ;
1062+ throw replaceFunctionName ( e as Error , 'startAt()' , 'Query.startAt()' ) ;
10391063 }
10401064 }
10411065
@@ -1046,7 +1070,11 @@ export class Query<T = PublicDocumentData>
10461070 query ( this . _delegate , startAfter ( ...args ) )
10471071 ) ;
10481072 } catch ( e ) {
1049- throw replaceFunctionName ( e , 'startAfter()' , 'Query.startAfter()' ) ;
1073+ throw replaceFunctionName (
1074+ e as Error ,
1075+ 'startAfter()' ,
1076+ 'Query.startAfter()'
1077+ ) ;
10501078 }
10511079 }
10521080
@@ -1057,15 +1085,15 @@ export class Query<T = PublicDocumentData>
10571085 query ( this . _delegate , endBefore ( ...args ) )
10581086 ) ;
10591087 } catch ( e ) {
1060- throw replaceFunctionName ( e , 'endBefore()' , 'Query.endBefore()' ) ;
1088+ throw replaceFunctionName ( e as Error , 'endBefore()' , 'Query.endBefore()' ) ;
10611089 }
10621090 }
10631091
10641092 endAt ( ...args : any [ ] ) : Query < T > {
10651093 try {
10661094 return new Query ( this . firestore , query ( this . _delegate , endAt ( ...args ) ) ) ;
10671095 } catch ( e ) {
1068- throw replaceFunctionName ( e , 'endAt()' , 'Query.endAt()' ) ;
1096+ throw replaceFunctionName ( e as Error , 'endAt()' , 'Query.endAt()' ) ;
10691097 }
10701098 }
10711099
@@ -1265,7 +1293,11 @@ export class CollectionReference<T = PublicDocumentData>
12651293 ) ;
12661294 }
12671295 } catch ( e ) {
1268- throw replaceFunctionName ( e , 'doc()' , 'CollectionReference.doc()' ) ;
1296+ throw replaceFunctionName (
1297+ e as Error ,
1298+ 'doc()' ,
1299+ 'CollectionReference.doc()'
1300+ ) ;
12691301 }
12701302 }
12711303
0 commit comments