Skip to content

Commit

Permalink
Keep error's original messages for NoSuchElementError.
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 committed Apr 17, 2024
1 parent d183d2a commit e97e32a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/transport/errors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ module.exports = {
if (err && (err.name in SeleniumNightwatchErrorCodeMap)) {
const statusCode = SeleniumNightwatchErrorCodeMap[err.name];

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

err.id = statusCode;

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

0 comments on commit e97e32a

Please sign in to comment.