errors

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package errors provides standardized error formatting and types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorType

type ErrorType string

ErrorType represents different categories of errors

const (
	// ValidationError represents validation failures
	ValidationError ErrorType = "validation"
	// ConfigError represents configuration issues
	ConfigError ErrorType = "config"
	// FileError represents file operation issues
	FileError ErrorType = "file"
	// GitError represents git-related issues
	GitError ErrorType = "git"
	// NetworkError represents network-related issues
	NetworkError ErrorType = "network"
	// InternalError represents internal application issues
	InternalError ErrorType = "internal"
)

type StandardError

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

StandardError represents a formatted error with context

func New

func New(errorType ErrorType, message string) *StandardError

New creates a new standardized error

func NewConfigError

func NewConfigError(message string, args ...interface{}) *StandardError

NewConfigError creates a config error

func NewFileError

func NewFileError(message string, args ...interface{}) *StandardError

NewFileError creates a file error

func NewGitError

func NewGitError(message string, args ...interface{}) *StandardError

NewGitError creates a git error

func NewValidationError

func NewValidationError(message string, args ...interface{}) *StandardError

NewValidationError creates a validation error

func Wrap

func Wrap(errorType ErrorType, message string, cause error) *StandardError

Wrap wraps an existing error with context

func WrapConfigError

func WrapConfigError(message string, cause error) *StandardError

WrapConfigError wraps a config error

func WrapFileError

func WrapFileError(message string, cause error) *StandardError

WrapFileError wraps a file error

func WrapGitError

func WrapGitError(message string, cause error) *StandardError

WrapGitError wraps a git error

func WrapValidationError

func WrapValidationError(message string, cause error) *StandardError

WrapValidationError wraps a validation error

func (*StandardError) Error

func (e *StandardError) Error() string

func (*StandardError) Unwrap

func (e *StandardError) Unwrap() error

func (*StandardError) WithContext

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

WithContext adds context information to an error

Jump to

Keyboard shortcuts

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