errors

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package errors provides typed errors for staghorn.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorCode

type ErrorCode string

ErrorCode identifies the type of error.

const (
	ErrConfigNotFound    ErrorCode = "CONFIG_NOT_FOUND"
	ErrConfigInvalid     ErrorCode = "CONFIG_INVALID"
	ErrGitHubAuthFailed  ErrorCode = "GITHUB_AUTH_FAILED"
	ErrGitHubFetchFailed ErrorCode = "GITHUB_FETCH_FAILED"
	ErrCacheNotFound     ErrorCode = "CACHE_NOT_FOUND"
	ErrCacheStale        ErrorCode = "CACHE_STALE"
	ErrNoNetwork         ErrorCode = "NO_NETWORK"
	ErrProjectNotFound   ErrorCode = "PROJECT_NOT_FOUND"
	ErrInvalidRepo       ErrorCode = "INVALID_REPO"
)

type StaghornError

type StaghornError struct {
	Code    ErrorCode
	Message string
	Hint    string
	Cause   error
}

StaghornError represents a typed error with user-friendly hints.

func CacheNotFound

func CacheNotFound(repo string) *StaghornError

CacheNotFound returns an error when cache doesn't exist.

func ConfigInvalid

func ConfigInvalid(reason string) *StaghornError

ConfigInvalid returns an error for invalid config.

func ConfigNotFound

func ConfigNotFound(path string) *StaghornError

ConfigNotFound returns an error for missing config file.

func GitHubAuthFailed

func GitHubAuthFailed(cause error) *StaghornError

GitHubAuthFailed returns an error for authentication failures.

func GitHubFetchFailed

func GitHubFetchFailed(repo string, cause error) *StaghornError

GitHubFetchFailed returns an error for fetch failures.

func InvalidRepo

func InvalidRepo(repo string) *StaghornError

InvalidRepo returns an error for malformed repo strings.

func New

func New(code ErrorCode, message, hint string) *StaghornError

New creates a new StaghornError.

func Wrap

func Wrap(code ErrorCode, message, hint string, cause error) *StaghornError

Wrap creates a new StaghornError wrapping an existing error.

func (*StaghornError) Error

func (e *StaghornError) Error() string

func (*StaghornError) Unwrap

func (e *StaghornError) Unwrap() error

Jump to

Keyboard shortcuts

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