Documentation
¶
Overview ¶
Package errors provides typed errors for staghorn.
Index ¶
- type ErrorCode
- type StaghornError
- func AnthropicAuthFailed() *StaghornError
- func CacheNotFound(repo string) *StaghornError
- func ConfigInvalid(reason string) *StaghornError
- func ConfigNotFound(path string) *StaghornError
- func GitHubAuthFailed(cause error) *StaghornError
- func GitHubFetchFailed(repo string, cause error) *StaghornError
- func InvalidRepo(repo string) *StaghornError
- func New(code ErrorCode, message, hint string) *StaghornError
- func OptimizationFailed(reason string, cause error) *StaghornError
- func ValidationFailed(missing []string) *StaghornError
- func Wrap(code ErrorCode, message, hint string, cause error) *StaghornError
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" ErrAnthropicAuthFailed ErrorCode = "ANTHROPIC_AUTH_FAILED" ErrOptimizationFailed ErrorCode = "OPTIMIZATION_FAILED" ErrValidationFailed ErrorCode = "VALIDATION_FAILED" )
type StaghornError ¶
StaghornError represents a typed error with user-friendly hints.
func AnthropicAuthFailed ¶ added in v0.6.0
func AnthropicAuthFailed() *StaghornError
AnthropicAuthFailed returns an error for missing Anthropic API key.
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 OptimizationFailed ¶ added in v0.6.0
func OptimizationFailed(reason string, cause error) *StaghornError
OptimizationFailed returns an error when optimization fails.
func ValidationFailed ¶ added in v0.6.0
func ValidationFailed(missing []string) *StaghornError
ValidationFailed returns an error when optimized content fails validation.
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