Debian Codegraph @

error.go

raw symbols SCIP
1 // SPDX-FileCopyrightText: 2024 Shun Sakai
2 //
3 // SPDX-License-Identifier: Apache-2.0 OR MIT
4
5 package lzip
6
7 import "errors"
8
9 // ErrInvalidMagic represents an error due to the magic number was invalid.
10 var ErrInvalidMagic = errors.New("lzip: invalid magic number")
11
12 // UnsupportedVersionError represents an error due to the version number stored
13 // in the header indicated the lzip format which is not supported by this
14 // package.
15 type UnsupportedVersionError struct {
16 // Version represents the obtained version number.
17 Version byte
18 }
19
20 // Error returns a string representation of an [UnsupportedVersionError].
21 func (e *UnsupportedVersionError) Error() string {
22 return "lzip: unsupported version number"
23 }
24
25 // UnknownVersionError represents an error due to the version number stored in
26 // the header was not recognized by this package.
27 type UnknownVersionError struct {
28 // Version represents the obtained version number.
29 Version byte
30 }
31
32 // Error returns a string representation of an [UnknownVersionError].
33 func (e *UnknownVersionError) Error() string {
34 return "lzip: unknown version number"
35 }
36
37 // DictSizeTooSmallError represents an error due to the dictionary size was
38 // smaller than 4 KiB.
39 type DictSizeTooSmallError struct {
40 // DictSize represents the obtained dictionary size.
41 DictSize uint32
42 }
43
44 // Error returns a string representation of a [DictSizeTooSmallError].
45 func (e *DictSizeTooSmallError) Error() string {
46 return "lzip: dictionary size is too small"
47 }
48
49 // DictSizeTooLargeError represents an error due to the dictionary size was
50 // larger than 512 MiB.
51 type DictSizeTooLargeError struct {
52 // DictSize represents the obtained dictionary size.
53 DictSize uint32
54 }
55
56 // Error returns a string representation of a [DictSizeTooLargeError].
57 func (e *DictSizeTooLargeError) Error() string {
58 return "lzip: dictionary size is too large"
59 }
60
61 // InvalidCRCError represents an error due to a CRC of the original
62 // uncompressed data mismatched.
63 type InvalidCRCError struct {
64 // CRC represents the obtained CRC.
65 CRC uint32
66 }
67
68 // Error returns a string representation of an [InvalidCRCError].
69 func (e *InvalidCRCError) Error() string {
70 return "lzip: CRC mismatch"
71 }
72
73 // InvalidDataSizeError represents an error due to the size of the original
74 // uncompressed data stored in the trailer and the actual size of it mismatched.
75 type InvalidDataSizeError struct {
76 // DataSize represents the obtained data size.
77 DataSize uint64
78 }
79
80 // Error returns a string representation of an [InvalidDataSizeError].
81 func (e *InvalidDataSizeError) Error() string {
82 return "lzip: data size mismatch"
83 }
84
85 // InvalidMemberSizeError represents an error due to the total size of the
86 // member stored in the trailer and the actual total size of it mismatched.
87 type InvalidMemberSizeError struct {
88 // MemberSize represents the obtained member size.
89 MemberSize uint64
90 }
91
92 // Error returns a string representation of an [InvalidMemberSizeError].
93 func (e *InvalidMemberSizeError) Error() string {
94 return "lzip: member size mismatch"
95 }
96
97 // MemberSizeTooLargeError represents an error due to the member size was
98 // larger than 2 PiB.
99 type MemberSizeTooLargeError struct {
100 // MemberSize represents the obtained member size.
101 MemberSize uint64
102 }
103
104 // Error returns a string representation of a [MemberSizeTooLargeError].
105 func (e *MemberSizeTooLargeError) Error() string {
106 return "lzip: member size is too large"
107 }