pdferrors

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package pdferrors provides error types and wrapping for pdf-cli.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFileNotFound     = errors.New("file not found")
	ErrNotPDF           = errors.New("not a valid PDF file")
	ErrInvalidPages     = errors.New("invalid page specification")
	ErrPasswordRequired = errors.New("password required")
	ErrWrongPassword    = errors.New("incorrect password")
	ErrCorruptPDF       = errors.New("PDF file is corrupted")
	ErrOutputExists     = errors.New("output file already exists")
)

Common error types

Functions

func FormatError

func FormatError(err error) string

FormatError formats an error for display to the user

func IsFileNotFound

func IsFileNotFound(err error) bool

IsFileNotFound checks if an error is a file not found error

func IsPasswordRequired

func IsPasswordRequired(err error) bool

IsPasswordRequired checks if an error indicates a password is required

func WrapError

func WrapError(operation string, file string, err error) error

WrapError wraps an error with additional context

Types

type PDFError

type PDFError struct {
	Operation string
	File      string
	Cause     error
	Hint      string
}

PDFError represents a user-friendly error for PDF operations

func NewPDFError

func NewPDFError(operation, file string, cause error) *PDFError

NewPDFError creates a new PDFError

func (*PDFError) Error

func (e *PDFError) Error() string

func (*PDFError) Unwrap

func (e *PDFError) Unwrap() error

func (*PDFError) WithHint

func (e *PDFError) WithHint(hint string) *PDFError

WithHint adds a hint to a PDFError

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL