Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/tools/accessiblity-utils/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ export class AccessibilityScanner {
return data;
} catch (err) {
if (axios.isAxiosError(err) && err.response?.data) {
if (err.response.status === 422) {
throw new Error(
"A scan with this name already exists. please update the name and run again.",
);
}
const msg =
(err.response.data as any).error ||
(err.response.data as any).message ||
Expand Down
21 changes: 14 additions & 7 deletions src/tools/appautomate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,20 @@ async function takeAppScreenshot(args: {
};

logger.info("Starting WebDriver session on BrowserStack...");
driver = await remote({
protocol: "https",
hostname: "hub.browserstack.com",
port: 443,
path: "/wd/hub",
capabilities,
});
try {
driver = await remote({
protocol: "https",
hostname: "hub.browserstack.com",
port: 443,
path: "/wd/hub",
capabilities,
});
} catch (error) {
logger.error("Error initializing WebDriver:", error);
throw new Error(
"Failed to initialize the WebDriver or a timeout occurred. Please try again.",
);
}

const screenshotBase64 = await driver.takeScreenshot();
const compressed = await maybeCompressBase64(screenshotBase64);
Expand Down
4 changes: 4 additions & 0 deletions src/tools/applive-utils/start-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export async function startSession(args: StartSessionArgs): Promise<string> {
const { app_url } = await uploadApp(appPath);
logger.info(`App uploaded: ${app_url}`);

if (!app_url) {
throw new Error("Failed to upload app. Please try again.");
}

// 7) Build URL & open
const deviceParam = sanitizeUrlParam(
selected.display_name.replace(/\s+/g, "+"),
Expand Down