errors

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAuthenticated = errors.New("not authenticated")
	ErrNoActiveDevice   = errors.New("no active device")
	ErrDeviceNotFound   = errors.New("device not found")
	ErrTrackNotFound    = errors.New("track not found")
	ErrPremiumRequired  = errors.New("spotify premium required")
	ErrRateLimited      = errors.New("rate limited")
	ErrNetworkError     = errors.New("network error")
	ErrTimeout          = errors.New("request timeout")
	ErrConfigNotFound   = errors.New("config file not found")
	ErrInvalidConfig    = errors.New("invalid configuration")
)

Error types for common failure scenarios.

Functions

func Format

func Format(err error) string

Format returns a formatted error message with suggestion if available.

func GetSuggestion

func GetSuggestion(err error) string

GetSuggestion returns a suggestion for the given error.

func WithSuggestion

func WithSuggestion(err error, suggestion string) error

WithSuggestion wraps an error with a helpful suggestion.

Types

type PartialResult

type PartialResult[T any] struct {
	Data   T
	Errors []error
}

PartialResult represents a result that may have partial failures.

func (*PartialResult[T]) AddError

func (p *PartialResult[T]) AddError(err error)

AddError adds an error to the partial result.

func (*PartialResult[T]) ErrorSummary

func (p *PartialResult[T]) ErrorSummary() string

ErrorSummary returns a summary of all errors.

func (*PartialResult[T]) HasErrors

func (p *PartialResult[T]) HasErrors() bool

HasErrors returns true if there were any errors.

type RiffError

type RiffError struct {
	Err        error
	Suggestion string
}

RiffError wraps an error with a user-friendly suggestion.

func (*RiffError) Error

func (e *RiffError) Error() string

func (*RiffError) Unwrap

func (e *RiffError) Unwrap() error

Jump to

Keyboard shortcuts

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