Documentation
¶
Overview ¶
Package errors provides sentinel errors and custom error types for the stackit application. Use errors.Is() and errors.As() to check for specific error types.
Package errors provides error wrapping helpers for consistent error messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Standard library error functions wrapped for convenience
var ( // ErrNotOnBranch indicates that HEAD is not on a branch ErrNotOnBranch = errors.New("not on a branch") // ErrNotOnBranchNoBranchSpecified indicates HEAD is not on a branch and no branch was specified ErrNotOnBranchNoBranchSpecified = errors.New("not on a branch and no branch specified") // ErrBranchNotFound indicates that a branch does not exist ErrBranchNotFound = errors.New("branch not found") // ErrRebaseNotInProgress indicates that no rebase is currently in progress ErrRebaseNotInProgress = errors.New("no rebase in progress") // ErrTrunkOperation indicates an invalid operation on the trunk branch ErrTrunkOperation = errors.New("invalid operation on trunk branch") // ErrBranchModificationRestricted indicates a branch cannot be modified due to its state (locked or frozen) ErrBranchModificationRestricted = errors.New("branch modification restricted") // ErrCanceled indicates that an interactive operation was canceled by the user ErrCanceled = errors.New("canceled") // ErrConflictWorkflow indicates a command entered the conflict-resolution // workflow. Resolution instructions have already been printed, so CLI // adapters should exit non-zero without printing this error again. ErrConflictWorkflow = errors.New("conflict workflow entered") // ErrBack indicates that the user wants to go back to the previous step ErrBack = errors.New("back") )
Sentinel errors for common conditions
Functions ¶
Types ¶
type BranchModificationError ¶
type BranchModificationError struct {
BranchName string
LockReason git.LockReason
IsFrozen bool
}
BranchModificationError represents an error when a branch cannot be modified
func NewBranchModificationError ¶
func NewBranchModificationError(branchName string, lockReason git.LockReason, frozen bool) *BranchModificationError
NewBranchModificationError creates a new BranchModificationError
func (*BranchModificationError) Error ¶
func (e *BranchModificationError) Error() string
func (*BranchModificationError) Is ¶
func (e *BranchModificationError) Is(target error) bool
Is returns true if the target error is ErrBranchModificationRestricted
func (*BranchModificationError) IsLocked ¶
func (e *BranchModificationError) IsLocked() bool
IsLocked returns true if the branch is locked
type ConflictWorkflowError ¶ added in v0.23.0
type ConflictWorkflowError struct {
BranchName string
}
ConflictWorkflowError reports that a restack stopped inside the conflict workflow on a specific branch. The user-facing resolution instructions were printed before this error was returned; it exists to carry the non-zero exit code (and the message for JSON output) without a duplicate terminal print.
func NewConflictWorkflowError ¶ added in v0.23.0
func NewConflictWorkflowError(branchName string) *ConflictWorkflowError
NewConflictWorkflowError creates a new ConflictWorkflowError
func (*ConflictWorkflowError) Error ¶ added in v0.23.0
func (e *ConflictWorkflowError) Error() string
func (*ConflictWorkflowError) Is ¶ added in v0.23.0
func (e *ConflictWorkflowError) Is(target error) bool
Is returns true if the target error is ErrConflictWorkflow