UNPKG

@u4/adbkit

Version:

A Typescript client for the Android Debug Bridge.

51 lines 1.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AdbUnexpectedDataError = exports.AdbPrematureEOFError = exports.AdbFailError = exports.AdbError = void 0; /** * AdbError is the common parent class for all ADB Exceptions: * AdbFailError AdbPrematureEOFError and AdbUnexpectedDataError */ class AdbError extends Error { constructor(message, lastMessage) { super(message + ' lastMessage:' + lastMessage); this.lastMessage = lastMessage; } } exports.AdbError = AdbError; /** * a command call respond an Error */ class AdbFailError extends AdbError { constructor(message, lastMessage) { super(`Failure: '${message}'`, lastMessage); Object.setPrototypeOf(this, AdbFailError.prototype); this.name = 'AdbFailError'; Error.captureStackTrace(this, AdbFailError); } } exports.AdbFailError = AdbFailError; /** * the connection get interupt before the end of expected response */ class AdbPrematureEOFError extends AdbError { constructor(missingBytes, lastMessage) { super(`Premature end of stream, needed ${missingBytes} more bytes`, lastMessage); this.missingBytes = missingBytes; Object.setPrototypeOf(this, AdbPrematureEOFError.prototype); this.name = 'AdbPrematureEOFError'; Error.captureStackTrace(this, AdbPrematureEOFError); } } exports.AdbPrematureEOFError = AdbPrematureEOFError; class AdbUnexpectedDataError extends AdbError { constructor(unexpected, expected, lastMessage) { super(`Unexpected '${unexpected}', was expecting ${expected}`, lastMessage); this.unexpected = unexpected; this.expected = expected; Object.setPrototypeOf(this, AdbUnexpectedDataError.prototype); this.name = 'AdbUnexpectedDataError'; Error.captureStackTrace(this, AdbUnexpectedDataError); } } exports.AdbUnexpectedDataError = AdbUnexpectedDataError; //# sourceMappingURL=errors.js.map