UNPKG

@u4/adbkit

Version:

A Typescript client for the Android Debug Bridge.

44 lines 1.63 kB
/** * AdbError is the common parent class for all ADB Exceptions: * AdbFailError AdbPrematureEOFError and AdbUnexpectedDataError */ export class AdbError extends Error { constructor(message, lastMessage) { super(message + ' lastMessage:' + lastMessage); this.lastMessage = lastMessage; } } /** * a command call respond an Error */ export class AdbFailError extends AdbError { constructor(message, lastMessage) { super(`Failure: '${message}'`, lastMessage); Object.setPrototypeOf(this, AdbFailError.prototype); this.name = 'AdbFailError'; Error.captureStackTrace(this, AdbFailError); } } /** * the connection get interupt before the end of expected response */ export 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); } } export 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); } } //# sourceMappingURL=errors.js.map