@@ -22,6 +22,7 @@ import MaestroOptions, {
2222} from './models/maestro_options' ;
2323import Maestro from './providers/maestro' ;
2424import Login from './providers/login' ;
25+ import TestingBotError from './models/testingbot_error' ;
2526
2627const program = new Command ( ) ;
2728
@@ -137,9 +138,15 @@ const espressoCommand = program
137138 )
138139 // CI/CD metadata
139140 . option ( '--commit-sha <sha>' , 'The commit SHA of this upload.' )
140- . option ( '--pull-request-id <id>' , 'The ID of the pull request this upload originated from.' )
141+ . option (
142+ '--pull-request-id <id>' ,
143+ 'The ID of the pull request this upload originated from.' ,
144+ )
141145 . option ( '--repo-name <name>' , 'Repository name (e.g., GitHub repo slug).' )
142- . option ( '--repo-owner <owner>' , 'Repository owner (e.g., GitHub organization or user slug).' )
146+ . option (
147+ '--repo-owner <owner>' ,
148+ 'Repository owner (e.g., GitHub organization or user slug).' ,
149+ )
143150 // Authentication
144151 . option ( '--api-key <key>' , 'TestingBot API key.' )
145152 . option ( '--api-secret <secret>' , 'TestingBot API secret.' )
@@ -155,14 +162,14 @@ const espressoCommand = program
155162 }
156163
157164 const metadata =
158- args . commitSha || args . pullRequestId || args . repoName || args . repoOwner
159- ? {
160- commitSha : args . commitSha ,
161- pullRequestId : args . pullRequestId ,
162- repoName : args . repoName ,
163- repoOwner : args . repoOwner ,
164- }
165- : undefined ;
165+ args . commitSha || args . pullRequestId || args . repoName || args . repoOwner
166+ ? {
167+ commitSha : args . commitSha ,
168+ pullRequestId : args . pullRequestId ,
169+ repoName : args . repoName ,
170+ repoOwner : args . repoOwner ,
171+ }
172+ : undefined ;
166173
167174 const options = new EspressoOptions ( app , testApp , args . device , {
168175 version : args . platformVersion ,
@@ -195,7 +202,7 @@ const espressoCommand = program
195202 apiSecret : args . apiSecret ,
196203 } ) ;
197204 if ( credentials === null ) {
198- throw new Error (
205+ throw new TestingBotError (
199206 'No TestingBot credentials found. Please authenticate using one of these methods:\n' +
200207 ' 1. Run "testingbot login" to authenticate via browser (recommended)\n' +
201208 ' 2. Use --api-key and --api-secret options\n' +
@@ -333,9 +340,15 @@ const maestroCommand = program
333340 )
334341 // CI/CD metadata
335342 . option ( '--commit-sha <sha>' , 'The commit SHA of this upload.' )
336- . option ( '--pull-request-id <id>' , 'The ID of the pull request this upload originated from.' )
343+ . option (
344+ '--pull-request-id <id>' ,
345+ 'The ID of the pull request this upload originated from.' ,
346+ )
337347 . option ( '--repo-name <name>' , 'Repository name (e.g., GitHub repo slug).' )
338- . option ( '--repo-owner <owner>' , 'Repository owner (e.g., GitHub organization or user slug).' )
348+ . option (
349+ '--repo-owner <owner>' ,
350+ 'Repository owner (e.g., GitHub organization or user slug).' ,
351+ )
339352 // Authentication
340353 . option ( '--api-key <key>' , 'TestingBot API key.' )
341354 . option ( '--api-secret <secret>' , 'TestingBot API secret.' )
@@ -373,14 +386,14 @@ const maestroCommand = program
373386 }
374387
375388 const metadata =
376- args . commitSha || args . pullRequestId || args . repoName || args . repoOwner
377- ? {
378- commitSha : args . commitSha ,
379- pullRequestId : args . pullRequestId ,
380- repoName : args . repoName ,
381- repoOwner : args . repoOwner ,
382- }
383- : undefined ;
389+ args . commitSha || args . pullRequestId || args . repoName || args . repoOwner
390+ ? {
391+ commitSha : args . commitSha ,
392+ pullRequestId : args . pullRequestId ,
393+ repoName : args . repoName ,
394+ repoOwner : args . repoOwner ,
395+ }
396+ : undefined ;
384397
385398 const options = new MaestroOptions ( app , flows , args . device , {
386399 includeTags : args . includeTags ,
@@ -414,7 +427,7 @@ const maestroCommand = program
414427 apiSecret : args . apiSecret ,
415428 } ) ;
416429 if ( credentials === null ) {
417- throw new Error (
430+ throw new TestingBotError (
418431 'No TestingBot credentials found. Please authenticate using one of these methods:\n' +
419432 ' 1. Run "testingbot login" to authenticate via browser (recommended)\n' +
420433 ' 2. Use --api-key and --api-secret options\n' +
@@ -500,9 +513,15 @@ const xcuitestCommand = program
500513 )
501514 // CI/CD metadata
502515 . option ( '--commit-sha <sha>' , 'The commit SHA of this upload.' )
503- . option ( '--pull-request-id <id>' , 'The ID of the pull request this upload originated from.' )
516+ . option (
517+ '--pull-request-id <id>' ,
518+ 'The ID of the pull request this upload originated from.' ,
519+ )
504520 . option ( '--repo-name <name>' , 'Repository name (e.g., GitHub repo slug).' )
505- . option ( '--repo-owner <owner>' , 'Repository owner (e.g., GitHub organization or user slug).' )
521+ . option (
522+ '--repo-owner <owner>' ,
523+ 'Repository owner (e.g., GitHub organization or user slug).' ,
524+ )
506525 // Authentication
507526 . option ( '--api-key <key>' , 'TestingBot API key.' )
508527 . option ( '--api-secret <secret>' , 'TestingBot API secret.' )
@@ -518,14 +537,14 @@ const xcuitestCommand = program
518537 }
519538
520539 const metadata =
521- args . commitSha || args . pullRequestId || args . repoName || args . repoOwner
522- ? {
523- commitSha : args . commitSha ,
524- pullRequestId : args . pullRequestId ,
525- repoName : args . repoName ,
526- repoOwner : args . repoOwner ,
527- }
528- : undefined ;
540+ args . commitSha || args . pullRequestId || args . repoName || args . repoOwner
541+ ? {
542+ commitSha : args . commitSha ,
543+ pullRequestId : args . pullRequestId ,
544+ repoName : args . repoName ,
545+ repoOwner : args . repoOwner ,
546+ }
547+ : undefined ;
529548
530549 const options = new XCUITestOptions ( app , testApp , args . device , {
531550 version : args . platformVersion ,
@@ -551,7 +570,7 @@ const xcuitestCommand = program
551570 apiSecret : args . apiSecret ,
552571 } ) ;
553572 if ( credentials === null ) {
554- throw new Error (
573+ throw new TestingBotError (
555574 'No TestingBot credentials found. Please authenticate using one of these methods:\n' +
556575 ' 1. Run "testingbot login" to authenticate via browser (recommended)\n' +
557576 ' 2. Use --api-key and --api-secret options\n' +
0 commit comments