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 {
83
83
return data ;
84
84
} catch ( err ) {
85
85
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
+ }
86
91
const msg =
87
92
( err . response . data as any ) . error ||
88
93
( err . response . data as any ) . message ||
Original file line number Diff line number Diff line change @@ -104,13 +104,20 @@ async function takeAppScreenshot(args: {
104
104
} ;
105
105
106
106
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
+ }
114
121
115
122
const screenshotBase64 = await driver . takeScreenshot ( ) ;
116
123
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> {
64
64
const { app_url } = await uploadApp ( appPath ) ;
65
65
logger . info ( `App uploaded: ${ app_url } ` ) ;
66
66
67
+ if ( ! app_url ) {
68
+ throw new Error ( "Failed to upload app. Please try again." ) ;
69
+ }
70
+
67
71
// 7) Build URL & open
68
72
const deviceParam = sanitizeUrlParam (
69
73
selected . display_name . replace ( / \s + / g, "+" ) ,
You can’t perform that action at this time.
0 commit comments