errors

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package errors provides custom error types and error handling utilities for YAP.

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 in the application.

const (
	// ErrTypeValidation represents validation errors.
	ErrTypeValidation ErrorType = "validation"
	// ErrTypeFileSystem represents filesystem errors.
	ErrTypeFileSystem ErrorType = "filesystem"
	// ErrTypeNetwork represents network errors.
	ErrTypeNetwork ErrorType = "network"
	// ErrTypePackaging represents packaging errors.
	ErrTypePackaging ErrorType = "packaging"
	// ErrTypeConfiguration represents configuration errors.
	ErrTypeConfiguration ErrorType = "configuration"
	// ErrTypeBuild represents build errors.
	ErrTypeBuild ErrorType = "build"
	// ErrTypeParser represents parser errors.
	ErrTypeParser ErrorType = "parser"
	// ErrTypeInternal represents internal errors.
	ErrTypeInternal ErrorType = "internal"
)

type YapError

type YapError struct {
	Type      ErrorType
	Message   string
	Cause     error
	Operation string
	Context   map[string]any
}

YapError represents a structured error with context.

func New

func New(errType ErrorType, message string) *YapError

New creates a new YapError.

func Wrap

func Wrap(err error, errType ErrorType, message string) *YapError

Wrap wraps an existing error with YapError context.

func (*YapError) Error

func (e *YapError) Error() string

Error implements the error interface.

func (*YapError) Unwrap

func (e *YapError) Unwrap() error

Unwrap returns the underlying cause for error unwrapping.

func (*YapError) WithContext

func (e *YapError) WithContext(key string, value any) *YapError

WithContext adds context information to the error.

func (*YapError) WithOperation

func (e *YapError) WithOperation(op string) *YapError

WithOperation sets the operation that caused the error.

Jump to

Keyboard shortcuts

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