Error functions reference

The following functions are provided by the package manager for error handling.

Function Details
die

Displays an error message provided in its argument, and aborts the build process.

In EAPI 6 and later, die can be called under the nonfatal command and with the -n option, in which case it will not abort the build process, but return with non-zero status.

pipestatus

Checks if all commands in the last executed pipeline have returned an exit status of zero, and is normally combined with || die. When passed the -v option, it also prints the pipeline's exit status values, which makes it easier to identify the stage that failed.

This command is provided by the package manager in EAPI 9 and later. In earlier EAPIs, inherit eapi9-pipestatus.eclass to get it.

assert Checks the value of the PIPESTATUS array, and calls die if any component is non-zero (which indicates failure of the preceding command pipeline). Banned in EAPI 9, use pipestatus instead.
nonfatal Takes another command as its argument and executes it. If the command fails and would normally die, it returns with non-zero status instead when called under nonfatal.