Files
SWCompression/Sources/XZError.swift
T
Timofey Solomko 39eea7c42a Split code into separate files
Overtime size of source files became unmanageble, so it is better to split them. Also internal zip structure have been renamed to include word zip.
2017-07-06 18:41:30 +03:00

43 lines
1.6 KiB
Swift

// Copyright (c) 2017 Timofey Solomko
// Licensed under MIT License
//
// See LICENSE for license information
import Foundation
/**
Represents an error, which happened during unarchiving XZ archive.
It may indicate that either archive is damaged or it might not be XZ archive at all.
*/
public enum XZError: Error {
/// Either 'magic' number in header or footer isn't equal to a predefined value.
case wrongMagic
/// One of the fields in archive has an incorrect value.
case wrongFieldValue
/**
One of the reserved fields in archive has an unexpected value, which can also mean (apart from damaged archive),
that archive uses a newer version of XZ format.
*/
case fieldReservedValue
/// Checksum of one of the fields of archive doesn't match the value stored in archive.
case wrongInfoCRC
/// Filter used in archvie is unsupported.
case wrongFilterID
/// Archive uses SHA-256 checksum which is unsupported.
case checkTypeSHA256
/**
Either size of decompressed data isn't equal to the one specified in archive or
amount of compressed data read is different from the one stored in archive.
*/
case wrongDataSize
/**
Computed checksum of uncompressed data doesn't match the value stored in the archive.
Associated value of the error contains already decompressed data.
*/
case wrongCheck(Data)
/// Padding (null-bytes appended to an archive's structure) is incorrect.
case wrongPadding
/// Either null byte encountered or exceeded maximum amount bytes during reading multi byte number.
case multiByteIntegerError
}