Skip to content

Commit b47a82f

Browse files
committed
Move driver.executeScript to try as well
1 parent 5c66391 commit b47a82f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,15 +389,15 @@ const getDeviceName = ({
389389
} finally {
390390
if (!driver) return;
391391

392-
const reason = errorMessage?.replace(/"/g, "'") || "";
392+
try {
393+
const reason = errorMessage?.replace(/"/g, "'") || "";
393394

394-
driver.executeScript(
395-
`browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"${
396-
errorMessage ? "failed" : "passed"
397-
}","reason": "${reason}"}}`
398-
);
395+
driver.executeScript(
396+
`browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"${
397+
errorMessage ? "failed" : "passed"
398+
}","reason": "${reason}"}}`
399+
);
399400

400-
try {
401401
const sessionId = await driver.getSession();
402402
console.log({ sessionId: sessionId?.id_ });
403403
if (sessionId?.id_) await driver.quit();

0 commit comments

Comments
 (0)