diff --git a/lib/transport/errors/index.js b/lib/transport/errors/index.js index 903084358d..4e1fc506ee 100644 --- a/lib/transport/errors/index.js +++ b/lib/transport/errors/index.js @@ -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; }