@hazae41/binary
Version:
Zero-copy binary data types
42 lines (39 loc) • 1.18 kB
JavaScript
;
class SizeUnknownError extends Error {
#class = SizeUnknownError;
name = this.#class.name;
constructor(options) {
super(`Could not size`, options);
}
static from(cause) {
return new SizeUnknownError({ cause });
}
}
class WriteUnknownError extends Error {
#class = WriteUnderflowError;
name = this.#class.name;
constructor(options) {
super(`Could not write`, options);
}
static from(cause) {
return new WriteUnknownError({ cause });
}
}
class WriteUnderflowError extends Error {
cursorOffset;
cursorLength;
#class = WriteUnderflowError;
name = this.#class.name;
constructor(cursorOffset, cursorLength) {
super(`Cursor has ${cursorLength - cursorOffset} remaining bytes after write`);
this.cursorOffset = cursorOffset;
this.cursorLength = cursorLength;
}
static from(cursor) {
return new WriteUnderflowError(cursor.offset, cursor.length);
}
}
exports.SizeUnknownError = SizeUnknownError;
exports.WriteUnderflowError = WriteUnderflowError;
exports.WriteUnknownError = WriteUnknownError;
//# sourceMappingURL=index.cjs.map