/** * @module * * errors thrown by the 7z library. every error is an instance of * {@link SevenZipError}, so callers can branch with `instanceof`. */ /** base class for every error thrown by the 7z library. */ export class SevenZipError extends Error { override name: string = 'SevenZipError'; } /** stored data did not match a CRC32 recorded in the archive. */ export class ChecksumMismatchError extends SevenZipError { override name: string = 'ChecksumMismatchError'; } /** * a password was supplied but does not match the archive's stored check * value. the caller can re-prompt and retry with a different password. */ export class InvalidPasswordError extends SevenZipError { override name: string = 'InvalidPasswordError'; } /** the source bytes do not begin with a recognized 7z signature. */ export class InvalidSignatureError extends SevenZipError { override name: string = 'InvalidSignatureError'; } /** the archive's structure is corrupt or violates the format spec; no retry will help. */ export class MalformedArchiveError extends SevenZipError { override name: string = 'MalformedArchiveError'; } /** * the archive (or one of its entries) is encrypted but no password was * supplied. the caller can prompt the user and retry with a password. */ export class MissingPasswordError extends SevenZipError { override name: string = 'MissingPasswordError'; } /** * the underlying {@link Reader} failed to deliver bytes. distinct from * {@link TruncatedArchiveError}, which fires when the reader succeeds but * the archive itself ends mid-structure. */ export class ReaderError extends SevenZipError { override name: string = 'ReaderError'; } /** the archive ends in the middle of a structure. */ export class TruncatedArchiveError extends SevenZipError { override name: string = 'TruncatedArchiveError'; } /** the archive uses a feature this library does not implement yet. */ export class UnsupportedFeatureError extends SevenZipError { override name: string = 'UnsupportedFeatureError'; }