exitcode

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

README

pkg/exitcode

Shared exit code constants and error type used by all SpecScore CLI commands and library consumers.

Outstanding Questions

None at this time.

Documentation

Overview

Package exitcode defines the shared exit code constants and error type used by all SpecScore CLI commands and library consumers.

Index

Constants

View Source
const (
	Success            = 0  // Operation completed successfully.
	Conflict           = 1  // Concurrent-modification conflict.
	InvalidArgs        = 2  // Missing or invalid command arguments/flags.
	NotFound           = 3  // Requested resource does not exist.
	InvalidState       = 4  // State transition is not allowed.
	AmbiguousSlug      = 5  // Slug auto-resolution found multiple candidates.
	TargetNotSpecScore = 6  // Target directory is not a SpecScore-managed repo.
	DirtyTree          = 7  // Working tree has uncommitted changes in paths to be modified.
	UnsupportedCommand = 8  // Subcommand not recognized — typically an outdated specscore that predates a required subcommand. Distinct from the shell's 127 (binary absent).
	Unexpected         = 10 // Catch-all for unexpected runtime errors.
)

Standard exit codes shared by every CLI command.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error carries a machine-readable exit code alongside a human-readable message. It satisfies both the error interface and the ExitCode() convention checked by the top-level CLI runner.

func ConflictError

func ConflictError(msg string) *Error

ConflictError returns an exit-code-1 error.

func ConflictErrorf

func ConflictErrorf(format string, args ...any) *Error

ConflictErrorf returns an exit-code-1 error with a formatted message.

func InvalidArgsError

func InvalidArgsError(msg string) *Error

InvalidArgsError returns an exit-code-2 error.

func InvalidArgsErrorf

func InvalidArgsErrorf(format string, args ...any) *Error

InvalidArgsErrorf returns an exit-code-2 error with a formatted message.

func InvalidStateError

func InvalidStateError(msg string) *Error

InvalidStateError returns an exit-code-4 error.

func InvalidStateErrorf

func InvalidStateErrorf(format string, args ...any) *Error

InvalidStateErrorf returns an exit-code-4 error with a formatted message.

func New

func New(code int, msg string) *Error

New creates an Error with the given exit code and message.

func Newf

func Newf(code int, format string, args ...any) *Error

Newf creates an Error with the given exit code and formatted message.

func NotFoundError

func NotFoundError(msg string) *Error

NotFoundError returns an exit-code-3 error.

func NotFoundErrorf

func NotFoundErrorf(format string, args ...any) *Error

NotFoundErrorf returns an exit-code-3 error with a formatted message.

func UnexpectedError

func UnexpectedError(msg string) *Error

UnexpectedError returns an exit-code-10 error.

func UnexpectedErrorf

func UnexpectedErrorf(format string, args ...any) *Error

UnexpectedErrorf returns an exit-code-10 error with a formatted message.

func UnsupportedCommandError added in v0.6.0

func UnsupportedCommandError(msg string) *Error

UnsupportedCommandError returns an exit-code-8 error.

func (*Error) Error

func (e *Error) Error() string

func (*Error) ExitCode

func (e *Error) ExitCode() int

ExitCode returns the numeric exit code for this error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL