Skip to content

Commit

Permalink
#1370 Handle error in a better way (#1381)
Browse files Browse the repository at this point in the history
* #1370 handle error from error message

Signed-off-by: NivedhaSenthil <[email protected]>

* #1370 handle case without executionContextId

Signed-off-by: NivedhaSenthil <[email protected]>

* Bump up version 1.0.16

Signed-off-by: NivedhaSenthil <[email protected]>
  • Loading branch information
NivedhaSenthil authored Jul 27, 2020
1 parent 9b22acd commit 9a8dc79
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
20 changes: 8 additions & 12 deletions lib/handlers/runtimeHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ const runtimeEvaluate = async (exp, executionContextId, opt = {}) => {
try {
runtimeResult = await runtime.evaluate(options);
} catch (e) {
if (
e.response &&
e.response.message === 'Cannot find context with specified id' &&
executionContextId
) {
executionContextIds = executionContextIds.filter((id) => id !== executionContextId);
if (e && e.message === 'Cannot find context with specified id') {
if (executionContextId) {
executionContextIds = executionContextIds.filter((id) => id !== executionContextId);
}
} else {
throw e;
}
Expand Down Expand Up @@ -97,12 +95,10 @@ const runtimeCallFunctionOn = async (exp, executionContextId, opt = {}) => {
try {
runtimeResult = await runtime.callFunctionOn(options);
} catch (e) {
if (
e.response &&
e.response.message === 'Cannot find context with specified id' &&
executionContextId
) {
executionContextIds = executionContextIds.filter((id) => id !== executionContextId);
if (e && e.message === 'Cannot find context with specified id') {
if (executionContextId) {
executionContextIds = executionContextIds.filter((id) => id !== executionContextId);
}
} else {
throw e;
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json.schemastore.org/package",
"name": "taiko",
"version": "1.0.15",
"version": "1.0.16",
"description": "Taiko is a Node.js library for automating Chromium based browsers",
"main": "bin/taiko.js",
"bin": {
Expand Down

0 comments on commit 9a8dc79

Please sign in to comment.