-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patherrors.go
More file actions
37 lines (27 loc) · 1.25 KB
/
errors.go
File metadata and controls
37 lines (27 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package gxpdf
import "errors"
// Common errors returned by gxpdf functions.
var (
// ErrInvalidPDF is returned when the file is not a valid PDF.
ErrInvalidPDF = errors.New("gxpdf: invalid PDF file")
// ErrEncrypted is returned when the PDF is encrypted and no password was provided.
ErrEncrypted = errors.New("gxpdf: PDF is encrypted")
// ErrWrongPassword is returned when the provided password is incorrect.
ErrWrongPassword = errors.New("gxpdf: wrong password")
// ErrCorrupted is returned when the PDF structure is corrupted.
ErrCorrupted = errors.New("gxpdf: PDF file is corrupted")
// ErrPageNotFound is returned when the requested page does not exist.
ErrPageNotFound = errors.New("gxpdf: page not found")
// ErrNoTables is returned when no tables were found on the page.
ErrNoTables = errors.New("gxpdf: no tables found")
// ErrUnsupportedFeature is returned for PDF features not yet implemented.
ErrUnsupportedFeature = errors.New("gxpdf: unsupported PDF feature")
)
// IsEncrypted returns true if the error indicates an encrypted PDF.
func IsEncrypted(err error) bool {
return errors.Is(err, ErrEncrypted)
}
// IsCorrupted returns true if the error indicates a corrupted PDF.
func IsCorrupted(err error) bool {
return errors.Is(err, ErrCorrupted)
}