Skip to content

Commit

Permalink
Prefer original error message for NoSuchElementError. (#4191)
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 authored Apr 17, 2024
1 parent 2d08b15 commit 0e1b273
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/transport/errors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,16 @@ module.exports = {
if (err && (err.name in SeleniumNightwatchErrorCodeMap)) {
const statusCode = SeleniumNightwatchErrorCodeMap[err.name];

return {
const error = {
...err,
...Errors[statusCode],
id: statusCode
};

for (const [key, value] of Object.entries(Errors[statusCode])) {
error[key] ||= value;
}

return error;
} else if (err && err.name && (err.stack || err.stackTrace)){
return err;
}
Expand Down

0 comments on commit 0e1b273

Please sign in to comment.