stdio_error.ts

The errors of the stdio host modules (stdin.ts, stdout.ts, and stderr.ts), apart from them.

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

view source

Declarations
#

3 declarations

is_stdio_error
#

stdio_error.ts view source

(error: unknown, kind?: "io_error" | undefined): error is StdioError import {is_stdio_error} from '@fuzdev/gro/stdio_error.js';

Whether error is a StdioError 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 "io_error"
optional

returns

boolean

StdioError
#

stdio_error.ts view source

import {StdioError} from '@fuzdev/gro/stdio_error.js';

The error the stdio host modules throw, typed by kind. Its message is exactly kind: target, and its cause is the stream's error, or the module's explanation where it has one. Match it with is_stdio_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 "io_error"

readonly

target

The stream: stdin, stdout, or stderr.

type string

readonly

constructor

type new (kind: "io_error", target: string, options?: ErrorOptions | undefined): StdioError

kind

type "io_error"

target

type string

options?

type ErrorOptions
optional

StdioErrorKind
#

stdio_error.ts view source

"io_error" import type {StdioErrorKind} from '@fuzdev/gro/stdio_error.js';

Why a stdio op failed. io_error is a read or write failure other than the reader going away, which is a false result from a write.

Imported by
#