MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / encodeError

Function encodeError

javascript/selenium-webdriver/lib/error.js:487–497  ·  view source on GitHub ↗

* @param {*} err The error to encode. * @return {{error: string, message: string}} the encoded error.

(err)

Source from the content-addressed store, hash-verified

485 * @return {{error: string, message: string}} the encoded error.
486 */
487function encodeError(err) {
488 let type = WebDriverError
489 if (err instanceof WebDriverError && TYPE_TO_ERROR_CODE.has(err.constructor)) {
490 type = err.constructor
491 }
492
493 let message = err instanceof Error ? err.message : err + ''
494
495 let code = /** @type {string} */ (TYPE_TO_ERROR_CODE.get(type))
496 return { error: code, message: message }
497}
498
499/**
500 * Tests if the given value is a valid error response object according to the

Callers

nothing calls this directly

Calls 2

getMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected