UNPKG

testplane

Version:

Tests framework based on mocha and wdio

41 lines 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CDPConnectionTerminatedError = exports.CDPTimeoutError = exports.CDPError = void 0; const constants_1 = require("./constants"); class CDPError extends Error { constructor({ message, code, requestId }) { let errorMessage = message; if (code) { errorMessage += `\n\tErrorCode: ${code}`; } if (requestId) { errorMessage += `\n\tCDP Request ID: ${requestId}`; } super(errorMessage); this.name = this.constructor.name; this.code = code; this.requestId = requestId; } isNonRetryable() { // JSON-RPC Protocol Errors // CDP State/Execution Errors // https://www.jsonrpc.org/specification#error_object return Boolean(this.code && ((this.code >= -32700 && this.code <= -32600) || this.code === -32000)); } } exports.CDPError = CDPError; class CDPTimeoutError extends CDPError { constructor({ message, requestId }) { super({ message, code: constants_1.CDP_ERROR_CODE.TIMEOUT, requestId }); this.name = this.constructor.name; } } exports.CDPTimeoutError = CDPTimeoutError; class CDPConnectionTerminatedError extends CDPError { constructor({ message = "CDP connection was manually closed", requestId, } = {}) { super({ message, code: constants_1.CDP_ERROR_CODE.CONNECTION_TERMINATED, requestId }); this.name = this.constructor.name; } } exports.CDPConnectionTerminatedError = CDPConnectionTerminatedError; //# sourceMappingURL=error.js.map