12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.ProtocolError = void 0;
- exports.isProtocolError = isProtocolError;
- exports.isSessionClosedError = isSessionClosedError;
- var _stackTrace = require("../utils/stackTrace");
- class ProtocolError extends Error {
- constructor(type, method, logs) {
- super();
- this.type = void 0;
- this.method = void 0;
- this.logs = void 0;
- this.type = type;
- this.method = method;
- this.logs = logs;
- }
- setMessage(message) {
- (0, _stackTrace.rewriteErrorMessage)(this, `Protocol error (${this.method}): ${message}`);
- }
- browserLogMessage() {
- return this.logs ? '\nBrowser logs:\n' + this.logs : '';
- }
- }
- exports.ProtocolError = ProtocolError;
- function isProtocolError(e) {
- return e instanceof ProtocolError;
- }
- function isSessionClosedError(e) {
- return e instanceof ProtocolError && (e.type === 'closed' || e.type === 'crashed');
- }
|