Documentation
¶
Overview ¶
Package errors provides custom error types for user-friendly error messaging.
This package distinguishes between user-facing errors and technical errors, allowing the CLI to display clean messages while preserving technical details for debugging with verbose flags.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserError ¶
type UserError struct {
// Message is the user-friendly error message displayed to users.
Message string
// Err is the underlying technical error, preserved for debugging
// but hidden from normal output.
Err error
// Hint provides actionable guidance to help users resolve the issue.
Hint string
}
UserError represents an error with a user-friendly message.
UserError separates user-facing messages from technical implementation details, making CLI output cleaner while preserving debugging information for verbose mode.
func IsUserError ¶
IsUserError checks whether an error chain contains a UserError.
It uses errors.As to walk the error chain and returns the first UserError found. The second return value indicates whether a UserError was found.
func NewUserError ¶
NewUserError creates a user-facing error with a message.
Use this for simple errors that don't need hints or wrapped technical errors.
func NewUserErrorWithHint ¶
NewUserErrorWithHint creates a user-facing error with a message and actionable hint.
The hint should provide specific instructions to help users resolve the issue, such as command examples or documentation links.
func WrapUserError ¶
WrapUserError wraps a technical error with a user-friendly message.
The technical error is preserved for debugging with verbose flags but hidden from normal output.
func WrapUserErrorWithHint ¶
WrapUserErrorWithHint wraps a technical error with a user-friendly message and hint.
This combines a clean user message, actionable guidance, and technical details for debugging.