Documentation
¶
Overview ¶
Package errors provides typed errors for staghorn.
Index ¶
- type ErrorCode
- type 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 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" )
type StaghornError ¶
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
Click to show internal directories.
Click to hide internal directories.