11import { ReadStream } from "fs" ;
22
3- import { appDistributionOrigin } from "../api" ;
4- import { Client , ClientResponse } from "../apiv2" ;
5- import { FirebaseError } from "../error" ;
6- import * as operationPoller from "../operation-poller" ;
73import * as utils from "../utils" ;
4+ import * as operationPoller from "../operation-poller" ;
85import { Distribution } from "./distribution" ;
6+ import { FirebaseError , getErrMsg } from "../error" ;
7+ import { Client , ClientResponse } from "../apiv2" ;
8+ import { appDistributionOrigin } from "../api" ;
9+
910import {
1011 AabInfo ,
1112 BatchRemoveTestersResponse ,
@@ -83,8 +84,8 @@ export class AppDistributionClient {
8384
8485 try {
8586 await this . appDistroV1Client . patch ( `/${ releaseName } ` , data , { queryParams } ) ;
86- } catch ( err : any ) {
87- throw new FirebaseError ( `failed to update release notes with ${ err ?. message } ` ) ;
87+ } catch ( err : unknown ) {
88+ throw new FirebaseError ( `failed to update release notes with ${ getErrMsg ( err ) } ` ) ;
8889 }
8990
9091 utils . logSuccess ( "added release notes successfully" ) ;
@@ -172,8 +173,8 @@ export class AppDistributionClient {
172173 path : `${ projectName } /testers:batchAdd` ,
173174 body : { emails : emails } ,
174175 } ) ;
175- } catch ( err : any ) {
176- throw new FirebaseError ( `Failed to add testers ${ err } ` ) ;
176+ } catch ( err : unknown ) {
177+ throw new FirebaseError ( `Failed to add testers ${ getErrMsg ( err ) } ` ) ;
177178 }
178179
179180 utils . logSuccess ( `Testers created successfully` ) ;
@@ -190,8 +191,8 @@ export class AppDistributionClient {
190191 path : `${ projectName } /testers:batchRemove` ,
191192 body : { emails : emails } ,
192193 } ) ;
193- } catch ( err : any ) {
194- throw new FirebaseError ( `Failed to remove testers ${ err } ` ) ;
194+ } catch ( err : unknown ) {
195+ throw new FirebaseError ( `Failed to remove testers ${ getErrMsg ( err ) } ` ) ;
195196 }
196197 return apiResponse . body ;
197198 }
@@ -229,8 +230,8 @@ export class AppDistributionClient {
229230 alias === undefined ? `${ projectName } /groups` : `${ projectName } /groups?groupId=${ alias } ` ,
230231 body : { displayName : displayName } ,
231232 } ) ;
232- } catch ( err : any ) {
233- throw new FirebaseError ( `Failed to create group ${ err } ` ) ;
233+ } catch ( err : unknown ) {
234+ throw new FirebaseError ( `Failed to create group ${ getErrMsg ( err ) } ` ) ;
234235 }
235236 return apiResponse . body ;
236237 }
@@ -241,8 +242,8 @@ export class AppDistributionClient {
241242 method : "DELETE" ,
242243 path : groupName ,
243244 } ) ;
244- } catch ( err : any ) {
245- throw new FirebaseError ( `Failed to delete group ${ err } ` ) ;
245+ } catch ( err : unknown ) {
246+ throw new FirebaseError ( `Failed to delete group ${ getErrMsg ( err ) } ` ) ;
246247 }
247248
248249 utils . logSuccess ( `Group deleted successfully` ) ;
@@ -255,8 +256,8 @@ export class AppDistributionClient {
255256 path : `${ groupName } :batchJoin` ,
256257 body : { emails : emails } ,
257258 } ) ;
258- } catch ( err : any ) {
259- throw new FirebaseError ( `Failed to add testers to group ${ err } ` ) ;
259+ } catch ( err : unknown ) {
260+ throw new FirebaseError ( `Failed to add testers to group ${ getErrMsg ( err ) } ` ) ;
260261 }
261262
262263 utils . logSuccess ( `Testers added to group successfully` ) ;
@@ -269,8 +270,8 @@ export class AppDistributionClient {
269270 path : `${ groupName } :batchLeave` ,
270271 body : { emails : emails } ,
271272 } ) ;
272- } catch ( err : any ) {
273- throw new FirebaseError ( `Failed to remove testers from group ${ err } ` ) ;
273+ } catch ( err : unknown ) {
274+ throw new FirebaseError ( `Failed to remove testers from group ${ getErrMsg ( err ) } ` ) ;
274275 }
275276
276277 utils . logSuccess ( `Testers removed from group successfully` ) ;
@@ -291,8 +292,8 @@ export class AppDistributionClient {
291292 } ,
292293 } ) ;
293294 return response . body ;
294- } catch ( err : any ) {
295- throw new FirebaseError ( `Failed to create release test ${ err } ` ) ;
295+ } catch ( err : unknown ) {
296+ throw new FirebaseError ( `Failed to create release test ${ getErrMsg ( err ) } ` ) ;
296297 }
297298 }
298299
0 commit comments