errors

package
v0.0.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BerkshelfError

type BerkshelfError struct {
	Type        ErrorType
	Message     string
	Cause       error
	Context     map[string]interface{}
	Suggestions []string
}

BerkshelfError represents a structured error with context

func NewAuthenticationError

func NewAuthenticationError(message string, cause error) *BerkshelfError

NewAuthenticationError creates an authentication error

func NewConfigurationError

func NewConfigurationError(message string, cause error) *BerkshelfError

NewConfigurationError creates a configuration error

func NewFileSystemError

func NewFileSystemError(message string, cause error) *BerkshelfError

NewFileSystemError creates a filesystem error

func NewNetworkError

func NewNetworkError(message string, cause error) *BerkshelfError

NewNetworkError creates a network error

func NewParsingError

func NewParsingError(message string, cause error) *BerkshelfError

NewParsingError creates a parsing error

func NewResolutionError

func NewResolutionError(message string, cause error) *BerkshelfError

NewResolutionError creates a dependency resolution error

func NewValidationError

func NewValidationError(message string, cause error) *BerkshelfError

NewValidationError creates a validation error

func (*BerkshelfError) Error

func (e *BerkshelfError) Error() string

Error implements the error interface

func (*BerkshelfError) Is

func (e *BerkshelfError) Is(target error) bool

Is checks if the error matches a target error type

func (*BerkshelfError) Unwrap

func (e *BerkshelfError) Unwrap() error

Unwrap returns the underlying cause

func (*BerkshelfError) WithContext

func (e *BerkshelfError) WithContext(key string, value interface{}) *BerkshelfError

WithContext adds context to an error

func (*BerkshelfError) WithSuggestion

func (e *BerkshelfError) WithSuggestion(suggestion string) *BerkshelfError

WithSuggestion adds a suggestion to an error

type ErrorCollector

type ErrorCollector struct {
	// contains filtered or unexported fields
}

ErrorCollector collects multiple errors and provides summary

func NewErrorCollector

func NewErrorCollector() *ErrorCollector

NewErrorCollector creates a new error collector

func (*ErrorCollector) Add

func (ec *ErrorCollector) Add(err error)

Add adds an error to the collection

func (*ErrorCollector) Error

func (ec *ErrorCollector) Error() string

Error returns a combined error message

func (*ErrorCollector) Errors

func (ec *ErrorCollector) Errors() []error

Errors returns all collected errors

func (*ErrorCollector) HasErrors

func (ec *ErrorCollector) HasErrors() bool

HasErrors returns true if there are any errors

func (*ErrorCollector) Summary

func (ec *ErrorCollector) Summary() map[ErrorType]int

Summary returns a summary of errors by type

type ErrorType

type ErrorType string

ErrorType represents different categories of errors

const (
	ErrorTypeValidation     ErrorType = "validation"
	ErrorTypeNetwork        ErrorType = "network"
	ErrorTypeResolution     ErrorType = "resolution"
	ErrorTypeParsing        ErrorType = "parsing"
	ErrorTypeFileSystem     ErrorType = "filesystem"
	ErrorTypeAuthentication ErrorType = "authentication"
	ErrorTypeConfiguration  ErrorType = "configuration"
)

Jump to

Keyboard shortcuts

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