exitcode

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package exitcode defines cover100's process exit codes and the error type that carries one.

The vocabulary is deliberately small and stable: scripts branch on these numbers, so a new meaning never reuses an existing number.

Index

Constants

View Source
const (
	// Success means the report was written. Collection warnings do not change
	// this: a run that salvaged a partial Go profile still produced a report.
	Success = 0
	// InvalidArgs means a flag value or argument was missing or malformed.
	InvalidArgs = 2
	// NotFound means the scan path does not exist, is not a directory, or
	// contains no Go module and no Node package.
	NotFound = 3
	// Unexpected is the catch-all for runtime failures: an unwritable report
	// path, a port that could not be bound, a panicking dependency.
	Unexpected = 10
)

Standard exit codes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

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

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 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 NotFoundErrorCause

func NotFoundErrorCause(msg string, cause error) *Error

NotFoundErrorCause maps a lookup or scan failure to exit 3 while keeping the underlying cause wrapped for errors.Is/errors.As.

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 UnexpectedErrorCause

func UnexpectedErrorCause(msg string, cause error) *Error

UnexpectedErrorCause maps a runtime cause to exit 10, keeping it wrapped.

func UnexpectedErrorf

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

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

func Wrap

func Wrap(code int, msg string, cause error) *Error

Wrap maps cause to code without discarding its identity.

func (*Error) Error

func (e *Error) Error() string

func (*Error) ExitCode

func (e *Error) ExitCode() int

ExitCode returns the process exit code for this error.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap preserves the underlying cause for errors.Is/errors.As.

Jump to

Keyboard shortcuts

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