Documentation
¶
Overview ¶
Package exitcode turns the error a tt command ends with into the process exit status, and reports that error to the user once.
The codes and the carrier that sets them are the SDK's (sdk.ExitError, sdk.ExitCode). This package adds the policy that belongs to tt rather than to the contract: which uncoded failures are the system's (Code), which errors the user has already seen (Silent), and the one place that logs an error and ends the process for code that cannot return it (Exit).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Code ¶
Code returns the process exit code tt ends with for err, whichever command returned it: sdk.ExitOK for nil; a code other than sdk.ExitFailure that err carries; sdk.ExitSystem when err is a failure of the system (see systemFailure); sdk.ExitFailure otherwise.
sdk.ExitFailure is the code every command wraps its errors in, so it is the weakest: a server that cannot be reached, wrapped as "resolving dependencies" with code 1, is still a system failure. A code other than 1 is a deliberate verdict - a build backend that failed, a multi-package install that partly succeeded, an external module's own status - and stands.
func Exit ¶
func Exit(err error)
Exit reports err and ends the process with Code(err); a nil err exits sdk.ExitOK.
A command returns its error to the root, which reports it and exits there. Exit is for the code that cannot: a callback of an interactive prompt that has no caller to return to.
Types ¶
This section is empty.