Documentation
¶
Overview ¶
Package errors provides structured error types for ReleasePilot. It implements error classification, wrapping, and recovery detection.
Index ¶
- func IsKind(err error, kind Kind) bool
- func IsRecoverable(err error) bool
- func IsSensitive(s string) bool
- func RedactError(err error) error
- func RedactSensitive(s string) string
- type Error
- func AI(op, message string) *Error
- func AIWrap(err error, op, message string) *Error
- func AIWrapSafe(err error, op, message string) *Error
- func Config(op, message string) *Error
- func ConfigWrap(err error, op, message string) *Error
- func Conflict(op, message string) *Error
- func ConflictWrap(err error, op, message string) *Error
- func E(args ...any) *Error
- func Git(op, message string) *Error
- func GitWrap(err error, op, message string) *Error
- func IO(op, message string) *Error
- func IOWrap(err error, op, message string) *Error
- func Internal(op, message string) *Error
- func InternalWrap(err error, op, message string) *Error
- func Network(op, message string) *Error
- func NetworkWrap(err error, op, message string) *Error
- func New(kind Kind, message string) *Error
- func Newf(kind Kind, format string, args ...any) *Error
- func NotFound(op, message string) *Error
- func NotFoundWrap(err error, op, message string) *Error
- func Plugin(op, message string) *Error
- func PluginWrap(err error, op, message string) *Error
- func State(op, message string) *Error
- func StateWrap(err error, op, message string) *Error
- func Template(op, message string) *Error
- func TemplateWrap(err error, op, message string) *Error
- func Timeout(op, message string) *Error
- func TimeoutWrap(err error, op, message string) *Error
- func Validation(op, message string) *Error
- func ValidationWrap(err error, op, message string) *Error
- func Version(op, message string) *Error
- func VersionWrap(err error, op, message string) *Error
- func Wrap(err error, kind Kind, op string, message string) *Error
- func WrapSafe(err error, kind Kind, op, message string) *Error
- func Wrapf(err error, kind Kind, op string, format string, args ...any) *Error
- type Kind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRecoverable ¶
IsRecoverable returns true if the error is recoverable.
func IsSensitive ¶
IsSensitive checks if a string contains sensitive patterns.
func RedactError ¶
RedactError creates a new error with sensitive data redacted from its message. If the error is nil, returns nil.
func RedactSensitive ¶
RedactSensitive removes sensitive information from an error message. It redacts API keys, tokens, and other secrets that should not appear in logs.
Types ¶
type Error ¶
type Error struct {
// Kind is the category of the error.
Kind Kind
// Op is the operation being performed when the error occurred.
Op string
// Message is a human-readable error message.
Message string
// Err is the underlying error.
Err error
// Recoverable indicates if the error can be recovered from.
Recoverable bool
// Details contains additional context about the error.
Details map[string]any
}
Error is the standard error type for ReleasePilot.
func AIWrapSafe ¶
AIWrapSafe wraps an error as an AI service error with sensitive data redacted. Use this instead of AIWrap when the underlying error might contain API keys or tokens.
func ConfigWrap ¶
ConfigWrap wraps an error as a configuration error.
func ConflictWrap ¶
ConflictWrap wraps an error as a conflict error.
func E ¶
E is a convenience function to create errors with various arguments. Arguments can be of type Kind, string (operation), error, or map[string]any (details).
func InternalWrap ¶
InternalWrap wraps an error as an internal error.
func NetworkWrap ¶
NetworkWrap wraps an error as a network error.
func NotFoundWrap ¶
NotFoundWrap wraps an error as a not found error.
func PluginWrap ¶
PluginWrap wraps an error as a plugin error.
func TemplateWrap ¶
TemplateWrap wraps an error as a template error.
func TimeoutWrap ¶
TimeoutWrap wraps an error as a timeout error.
func ValidationWrap ¶
ValidationWrap wraps an error as a validation error.
func VersionWrap ¶
VersionWrap wraps an error as a versioning error.
func (*Error) Is ¶
Is reports whether the target error matches this error. For *Error types, it checks if both the Kind and Op match. For sentinel errors (errors without Op), only Kind is compared.
func (*Error) WithDetail ¶
WithDetail adds a single detail to the error and returns the modified error.
type Kind ¶
type Kind uint8
Kind represents the category of an error.
const ( // KindUnknown indicates an error of unknown type. KindUnknown Kind = iota // KindConfig indicates a configuration error. KindConfig // KindGit indicates a git operation error. KindGit // KindVersion indicates a versioning error. KindVersion // KindPlugin indicates a plugin error. KindPlugin // KindAI indicates an AI service error. KindAI // KindTemplate indicates a template rendering error. KindTemplate // KindState indicates a state management error. KindState // KindNetwork indicates a network error. KindNetwork // KindIO indicates a file I/O error. KindIO // KindValidation indicates a validation error. KindValidation // KindPermission indicates a permission error. KindPermission // KindNotFound indicates a resource was not found. KindNotFound // KindConflict indicates a conflict error. KindConflict // KindTimeout indicates a timeout error. KindTimeout // KindCanceled indicates the operation was canceled. KindCanceled // KindInternal indicates an internal error. KindInternal )