errors

package
v0.0.0-...-b20d30c Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBlobNotFound      = errors.New("blob not found")
	ErrBlobExists        = errors.New("blob already exists on server")
	ErrInvalidHash       = errors.New("invalid hash")
	ErrInvalidSize       = errors.New("invalid size")
	ErrStreamCorrupted   = errors.New("stream corrupted")
	ErrAccessDenied      = errors.New("access denied")
	ErrInvalidManifest   = errors.New("invalid manifest")
	ErrHashMismatch      = errors.New("hash mismatch")
	ErrConnectionFailed  = errors.New("connection failed")
	ErrTimeout           = errors.New("operation timeout")
	ErrInvalidConfig     = errors.New("invalid configuration")
	ErrRequestTooLarge   = errors.New("request is too large")
	ErrInvalidData       = errors.New("Invalid data")
	ErrInvalidHashLen    = errors.New("Invalid blob hash length")
	ErrBlobProtected     = errors.New("requested blob is protected")
	ErrNoBlobData        = errors.New("no blob data received")
	ErrAlreadyConnected  = errors.New("already connected")
	ErrServerValidation  = errors.New("server validation error")
	ErrAcquisitionFailed = errors.New("failed to acquire blob from all transfer methods")
	ErrInvalidOffset     = errors.New("offset must be non-negative")
	ErrInvalidLimit      = errors.New("limit must be positive")
	ErrEndOfList         = errors.New("end of list reached")
)

Common errors

View Source
var (
	ErrFailedToCheckBlobExistence = errors.New("failed to check blob existence")
	ErrFailedToCheckNeededBlobs   = errors.New("failed to check needed blobs")
)

Storage operation errors

View Source
var (
	ErrFailedToParsePeerAddress        = errors.New("failed to parse peer address")
	ErrFailedToStoreBlob               = errors.New("failed to store blob")
	ErrFailedToMarshalBlobResponse     = errors.New("failed to marshal blob response")
	ErrFailedToMarshalTransferResponse = errors.New("failed to marshal transfer response")
	ErrFailedToSetReadDeadline         = errors.New("failed to set read deadline")
	ErrFailedToReadBlobData            = errors.New("failed to read blob data")
	ErrFailedToDecodeJSON              = errors.New("failed to decode JSON")
	ErrFailedToMarshalJSON             = errors.New("failed to marshal JSON")
	ErrFailedToSetWriteDeadline        = errors.New("failed to set write deadline")
	ErrFailedToWriteData               = errors.New("failed to write data")
)

Network and I/O operation errors

View Source
var (
	ErrBlobTooBig             = errors.New("blob must be at most 2097152 bytes")
	ErrBlobEmpty              = errors.New("blob is empty")
	ErrInvalidIV              = errors.New("IV length must equal to block size")
	ErrInvalidBlockLength     = errors.New("invalid block length")
	ErrInvalidDataLength      = errors.New("invalid data length")
	ErrInvalidPadding         = errors.New("invalid padding")
	ErrStreamTooShort         = errors.New("stream must be at least 2 blobs long")
	ErrInvalidSDBlob          = errors.New("sd blob is not valid")
	ErrMissingTerminatingBlob = errors.New("sd blob is missing the terminating 0-length blob")
	ErrBlobCountMismatch      = errors.New("number of blobs in stream does not match number of blobs in sd info")
	ErrUnexpectedEmptyBlob    = errors.New("got 0-length blob before end of stream")
	ErrBlobsOutOfOrder        = errors.New("blobs are out of order in sd blob")
)

Stream-specific errors (added from lbry.go)

View Source
var (
	ErrTransferStopped = errors.New("transfer is stopped")
)

Functions

func Base

func Base(format string, a ...any) error

Base returns a simple error with no stack trace attached

func DetectErrorType

func DetectErrorType(errorMsg string) error

DetectErrorType detects specific error types by string matching since errors come from different process

func Err

func Err(err any, fmtParams ...any) error

Err intelligently creates/handles errors, while preserving the stack trace. It works with errors from github.com/pkg/errors too.

func FullTrace

func FullTrace(err error) string

FullTrace returns the error type, message, and stack trace

func HasTrace

func HasTrace(err error) bool

HasTrace checks if error has a trace attached

func Is

func Is(e error, target error) bool

Is reports whether any error in e's chain matches target. It fully unwraps both errors (handling both causer and go-errors.Error types) before delegating to stdlib errors.Is for the final comparison.

func IsBlobNotFoundError

func IsBlobNotFoundError(err error) bool

IsBlobNotFoundError checks if an error represents a blob not found condition It checks both for the exact error object and string containment

func IsEndOfListError

func IsEndOfListError(err error) bool

IsEndOfListError checks if an error represents an end-of-list condition

func IsKnownErrorType

func IsKnownErrorType(err error) bool

IsKnownErrorType checks if an error is a known protocol error that shouldn't be wrapped

func Prefix

func Prefix(prefix string, err any) error

Prefix prefixes the message of the error with the given string

func Trace

func Trace(err error) string

Trace returns the stack trace

func Unwrap

func Unwrap(err error) error

Unwrap returns the original error that was wrapped

func Wrap

func Wrap(err any, skip int) *goerrors.Error

Wrap calls goerrors.Wrap, in case you want to skip a different amount

Types

This section is empty.

Jump to

Keyboard shortcuts

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