exitcode

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package exitcode defines the process exit codes of data export and import and maps errors to them.

Index

Constants

View Source
const (
	// ExitUsage is a parameter or usage error.
	ExitUsage = 1
	// ExitPreflight is a read-only preflight rejection: nothing was written anywhere.
	ExitPreflight = 2
	// ExitRuntime is a failure during execution, after the preflight passed.
	ExitRuntime = 3
	// ExitVerify is an import whose --verify found the target's row counts inconsistent with
	// the rows sent, or could not complete the check.
	ExitVerify = 4
	// ExitPlanChanged is an import stopped by --abort-on-plan-change: the plan re-checked after
	// writing the schema differed, so the schema is written but no data was sent.
	ExitPlanChanged = 5
	// ExitResume is a resume that is impossible: the progress file is unusable, a binding
	// differs, the export session is gone, the exported schema changed, or the plan differs
	// from the recorded one. No data was sent, nothing was deleted, and the progress file is
	// kept; an import may have written the schema already.
	ExitResume = 6
	// ExitHalted is an import halted by its resume duplication policy (block); what was
	// imported before is valid.
	ExitHalted = 7
)

Exit codes of data export and import; codes 1 to 3 and 6 are shared, 4, 5 and 7 are import only.

Variables

This section is empty.

Functions

func For

func For(err error) int

For maps an error to the exit code of its cause: an ExitError keeps its code, INVALID_ARGUMENT is a usage error, a refusal the server made before writing anything (permission, authentication, precondition, not found, or UNIMPLEMENTED from a server without data export) is a preflight rejection, and everything else failed at run time.

Types

type ExitError

type ExitError struct {
	Err  error
	Code int
}

ExitError carries a process exit code alongside the error.

func Exit

func Exit(code int, format string, args ...any) *ExitError

Exit wraps a formatted error with an exit code.

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) Unwrap

func (e *ExitError) Unwrap() error

Unwrap exposes the wrapped error to errors.Is / errors.As.

Jump to

Keyboard shortcuts

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