Enum in env compiler

EnvError

enum EnvError
Import
use env::{EnvError};
Source: compiler/src/builtin_docs/env.hy

The error of every fallible env function.

It implements Show, so format("%v", e) gives the variant name.

Variants#

InvalidInput#

An argument is malformed, for example a name, value or path that contains a NUL byte.

NotFound#

var asked for a variable that is not set.

ExecDisabled#

Reserved; no env function returns it today (a missing --allow-exec / --allow-exit grant is a compile error instead).

ExecFailed#

exec could not start the program, or the program was ended by a signal and has no exit code.

Other#

Any other failure: the working directory cannot be read or changed, or a variable’s value is not valid UTF-8.

Examples#

use env::{var, EnvError};
use tests::assert;
let missing = match var("COIL_DOC_SURELY_UNSET") {
    Result::Err(EnvError::NotFound) => true,
    default => false,
};
assert!(missing);

See also#

↑ ↓ navigate ↵ open