MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / throwDecodedError

Function throwDecodedError

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

* Throws an error coded from the W3C protocol. A generic error will be thrown * if the provided `data` is not a valid encoded error. * * @param {{error: string, message: string}} data The error data to decode. * @throws {WebDriverError} the decoded error. * @see https://w3c.github.io/webdriver/

(data)

Source from the content-addressed store, hash-verified

518 * @see https://w3c.github.io/webdriver/webdriver-spec.html#protocol
519 */
520function throwDecodedError(data) {
521 if (isErrorResponse(data)) {
522 let ctor = ERROR_CODE_TO_TYPE.get(data.error) || WebDriverError
523 let err = new ctor(data.message)
524 // TODO(jleyba): remove whichever case is excluded from the final W3C spec.
525 if (typeof data.stacktrace === 'string') {
526 err.remoteStacktrace = data.stacktrace
527 } else if (typeof data.stackTrace === 'string') {
528 err.remoteStacktrace = data.stackTrace
529 }
530 throw err
531 }
532 throw new WebDriverError('Unknown error: ' + JSON.stringify(data))
533}
534
535/**
536 * Checks a legacy response from the Selenium 2.0 wire protocol for an error.

Callers

nothing calls this directly

Calls 2

isErrorResponseFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected