Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDeadlineExceeded ¶
IsDeadlineExceeded checks if an error is due to a deadline exceeded error.
func IsInterrupted ¶
IsInterrupted checks if an error is due to interruption (signal or context cancellation).
Types ¶
type CencliError ¶
type CencliError interface {
// Title is the canonical identifier for the error.
// Must be short and concise, and not depend on context.
// Should not produce styled output.
Title() string
// Error is the underlying error detail.
// Should not produce styled output.
Error() string
// ShouldPrintUsage indicates whether the error should print usage
// information for the offending command when this error occurs.
ShouldPrintUsage() bool
}
func NewCencliError ¶
func NewCencliError(err error) CencliError
func NewDeadlineExceededError ¶
func NewDeadlineExceededError() CencliError
NewDeadlineExceededError creates a CencliError for deadline exceeded errors. This should used exclusively for context.DeadlineExceeded errors.
func NewInterruptedError ¶
func NewInterruptedError() CencliError
NewInterruptedError creates a CencliError for interrupted operations. This should used exclusively for context.Canceled errors.
func NewNoOrgIDError ¶ added in v0.1.0
func NewNoOrgIDError() CencliError
func NewUsageError ¶ added in v0.1.0
func NewUsageError(err error) CencliError
NewUsageError creates a CencliError for command usage errors. This should be used for errors like invalid flags, missing arguments, etc. These errors will trigger usage information to be printed.
func ParseContextError ¶
func ParseContextError(err error) CencliError
ParseContextError parses a context error into a CencliError. This should only be called on errors returned from ctx.Err().
type PartialError ¶
type PartialError interface {
CencliError
}
func ToPartialError ¶
func ToPartialError(err CencliError) PartialError
ToPartialError wraps a CencliError in a PartialError. If err is nil, it returns nil.