errors

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

internal/errors/errors.go

Package errors defines reusable error types for Aether. Using structured errors allows callers to inspect and react to specific failure modes, such as configuration issues, HTTP failures, or robots.txt violations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Kind Kind   // high-level category of the error
	Msg  string // descriptive message
	Err  error  // underlying error, if any
}

Error is Aether's structured error type.

It wraps a human-readable message and a Kind identifier so that callers can distinguish between different failure classes programmatically.

func New

func New(kind Kind, msg string, underlying error) *Error

New creates a new Error with the provided kind and message.

The underlying error may be nil if there is no nested error.

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the underlying error, enabling errors.Is/As usage.

type Kind

type Kind string

Kind represents a high-level category of error.

Grouping errors by Kind makes it easier for callers to implement policies such as "retry on HTTP errors, but fail fast on robots.txt".

const (
	// KindUnknown represents an unspecified error category.
	KindUnknown Kind = "unknown"

	// KindConfig indicates a configuration-related error.
	KindConfig Kind = "config"

	// KindHTTP indicates an HTTP-related error.
	KindHTTP Kind = "http"

	// KindRobots indicates a robots.txt-related error.
	KindRobots Kind = "robots"

	// KindParsing indicates an error while parsing HTML, RSS, etc.
	KindParsing Kind = "parsing"
)

Jump to

Keyboard shortcuts

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