Documentation
¶
Overview ¶
Package utils provides worker pool and concurrent processing utilities.
Package utils provides error handling types and contextual error wrapping.
Index ¶
- Variables
- func ConfigError(operation, path string, err error) error
- func ContentError(operation, filePath string, err error) error
- func FileSystemError(operation, path string, err error) error
- func IsCategory(err error, category error) bool
- func ParserError(operation, contentPath string, err error) error
- func ServerError(operation string, err error) error
- func TemplateError(operation, templateName string, err error) error
- func WrapWithContext(err error, category error, ctx ErrorContext) error
- type ContextualError
- type ErrorContext
- type WorkerPool
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ConfigError ¶
func ContentError ¶
func FileSystemError ¶
func IsCategory ¶
func ParserError ¶
func ServerError ¶
func TemplateError ¶
func WrapWithContext ¶
func WrapWithContext(err error, category error, ctx ErrorContext) error
Types ¶
type ContextualError ¶
type ContextualError struct {
Err error
Category error
Context ErrorContext
}
ContextualError wraps an error with additional context.
func (*ContextualError) Error ¶
func (e *ContextualError) Error() string
func (*ContextualError) Is ¶
func (e *ContextualError) Is(target error) bool
Is implements error matching for both category and underlying error.
func (*ContextualError) Unwrap ¶
func (e *ContextualError) Unwrap() error
type ErrorContext ¶
ErrorContext provides additional context for errors.
func GetErrorContext ¶
func GetErrorContext(err error) (ErrorContext, bool)
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool represents a pool of workers with Go 1.25.x enhancements.
func NewWorkerPool ¶
func NewWorkerPool(ctx context.Context) *WorkerPool
NewWorkerPool creates a new worker pool.
func (*WorkerPool) Close ¶
func (wp *WorkerPool) Close()
func (*WorkerPool) ProcessContentNodes ¶
func (wp *WorkerPool) ProcessContentNodes(nodes []any, processor func(ctx context.Context, node any) error) error
ProcessContentNodes processes content nodes concurrently.
func (*WorkerPool) ProcessFiles ¶
func (wp *WorkerPool) ProcessFiles(files []string, processor func(ctx context.Context, filePath string) error) error
ProcessFiles processes files concurrently.
Click to show internal directories.
Click to hide internal directories.