env_error.ts

The errors of the env host module (env.ts), apart from it.

Making or matching an error reads no environment, so this module grants nothing: code that only classifies a failure, or builds one, imports it without linking the host module, and a mock of the host module throws the same errors it does. The class and its prototype are frozen.

view source

Declarations
#

3 declarations

EnvError
#

env_error.ts view source

import {EnvError} from '@fuzdev/gro/env_error.js';

The error env.ts throws, typed by kind. Its message is exactly kind: target, the variable's name and never its value. Match it with is_env_error, which also recognizes one from another copy of Gro. The class and its prototype are frozen.

inheritance

extends: Error

name

type string

kind

type "not_granted"

readonly

target

The variable's name, never its value.

type string

readonly

constructor

type new (kind: "not_granted", target: string, options?: ErrorOptions | undefined): EnvError

kind

type "not_granted"

target

type string

options?

type ErrorOptions
optional

EnvErrorKind
#

env_error.ts view source

"not_granted" import type {EnvErrorKind} from '@fuzdev/gro/env_error.js';

Why an env op failed. not_granted is a variable name outside what the handle allows.

is_env_error
#

env_error.ts view source

(error: unknown, kind?: "not_granted" | undefined): error is EnvError import {is_env_error} from '@fuzdev/gro/env_error.js';

Whether error is an EnvError from any copy of Gro, optionally of one kind.

error

any thrown value

type unknown

kind?

when given, the kind the error must have

type "not_granted"
optional

returns

boolean

Imported by
#