File tree Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,11 @@ export class AccessibilityScanner {
8383 return data ;
8484 } catch ( err ) {
8585 if ( axios . isAxiosError ( err ) && err . response ?. data ) {
86+ if ( err . response . status === 422 ) {
87+ throw new Error (
88+ "A scan with this name already exists. please update the name and run again." ,
89+ ) ;
90+ }
8691 const msg =
8792 ( err . response . data as any ) . error ||
8893 ( err . response . data as any ) . message ||
Original file line number Diff line number Diff line change @@ -104,13 +104,20 @@ async function takeAppScreenshot(args: {
104104 } ;
105105
106106 logger . info ( "Starting WebDriver session on BrowserStack..." ) ;
107- driver = await remote ( {
108- protocol : "https" ,
109- hostname : "hub.browserstack.com" ,
110- port : 443 ,
111- path : "/wd/hub" ,
112- capabilities,
113- } ) ;
107+ try {
108+ driver = await remote ( {
109+ protocol : "https" ,
110+ hostname : "hub.browserstack.com" ,
111+ port : 443 ,
112+ path : "/wd/hub" ,
113+ capabilities,
114+ } ) ;
115+ } catch ( error ) {
116+ logger . error ( "Error initializing WebDriver:" , error ) ;
117+ throw new Error (
118+ "Failed to initialize the WebDriver or a timeout occurred. Please try again." ,
119+ ) ;
120+ }
114121
115122 const screenshotBase64 = await driver . takeScreenshot ( ) ;
116123 const compressed = await maybeCompressBase64 ( screenshotBase64 ) ;
Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ export async function startSession(args: StartSessionArgs): Promise<string> {
6464 const { app_url } = await uploadApp ( appPath ) ;
6565 logger . info ( `App uploaded: ${ app_url } ` ) ;
6666
67+ if ( ! app_url ) {
68+ throw new Error ( "Failed to upload app. Please try again." ) ;
69+ }
70+
6771 // 7) Build URL & open
6872 const deviceParam = sanitizeUrlParam (
6973 selected . display_name . replace ( / \s + / g, "+" ) ,
You can’t perform that action at this time.
0 commit comments