Avoid TypeError if stacktrace is undefined
MODIFY
lib/protocol/protocol.js
lib/protocol/protocol.js
@@ -435,10 +435,10 @@ function buildHandler (app, method, path, spec, driver, isSessCmd) {
currentProtocol = currentProtocol || extractProtocol(driver, req.params.sessionId || newSessionId);
let errMsg = err.stacktrace || err.stack;
- if (!errMsg.includes(err.message)) {
+ if (!_.includes(errMsg, err.message)) {
// if the message has more information, add it. but often the message
// is the first part of the stack trace
- errMsg = `${err.message} ${errMsg}`;
+ errMsg = `${err.message}${errMsg ? ('\n' + errMsg) : ''}`;
}
SESSIONS_CACHE.getLogger(req.params.sessionId || newSessionId, currentProtocol).debug(`Encountered ` +
`internal error running command: ${errMsg}`);

Avoid TypeError if stacktrace is undefined (#269)