IF Commons GitHub

governance/errno

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-anyfs-posix-governance FR-001

The codes a POSIX operation ends with, as a closed union: the fifteen a store can give cause for, each with the number Linux gives it and one sentence. A program that reads the code of an error (ENOENT, ESTALE) reads what a local file system would have said, so that what it does about it is the same on every store.

import { ERRNO_NUMBER, describeErrno } from "./errno.ts";
ERRNO_NUMBER.ENOENT; // 2
describeErrno("ESTALE"); // "the object changed since it was read"

Source: commons/anyfs-posix/src/governance/errno.ts

5 of 12 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

governance.ERRNOSconstno test imports it
const ERRNOS: readonly ["EACCES", "EBADF", "EEXIST", "EFBIG", "EINVAL", "EIO", "EISDIR", "ENAMETOOLONG", "ENOENT", "ENOTDIR", "ENOTEMPTY", "ENOTSUP", "EROFS", "ESTALE", "EXDEV"]

The codes, in the order of their names.

governance.Errnotypeno test imports it
type Errno = (typeof ERRNOS)[number];

One code.

governance.ERRNO_NUMBERconstno test imports it
const ERRNO_NUMBER: Readonly<Record<"EACCES" | "EBADF" | "EEXIST" | "EFBIG" | "EINVAL" | "EIO" | "EISDIR" | "ENAMETOOLONG" | "ENOENT" | "ENOTDIR" | "ENOTEMPTY" | "ENOTSUP" | "EROFS" | "ESTALE" | "EXDEV", number>>

The number Linux gives each code: a registry with one entry for each code, which the compiler holds.

governance.ERRNO_SUMMARYconstno test imports it
const ERRNO_SUMMARY: Readonly<Record<"EACCES" | "EBADF" | "EEXIST" | "EFBIG" | "EINVAL" | "EIO" | "EISDIR" | "ENAMETOOLONG" | "ENOENT" | "ENOTDIR" | "ENOTEMPTY" | "ENOTSUP" | "EROFS" | "ESTALE" | "EXDEV", string>>

What each code says, in a sentence.

governance.isErrnofunctionno test imports it
function isErrno(text: string): text is "EACCES" | "EBADF" | "EEXIST" | "EFBIG" | "EINVAL" | "EIO" | "EISDIR" | "ENAMETOOLONG" | "ENOENT" | "ENOTDIR" | "ENOTEMPTY" | "ENOTSUP" | "EROFS" | "ESTALE" | "EXDEV"

Whether a text is the name of a code.

governance.describeErrnofunctionno test imports it
function describeErrno(errno: "EACCES" | "EBADF" | "EEXIST" | "EFBIG" | "EINVAL" | "EIO" | "EISDIR" | "ENAMETOOLONG" | "ENOENT" | "ENOTDIR" | "ENOTEMPTY" | "ENOTSUP" | "EROFS" | "ESTALE" | "EXDEV"): string

A code in a few words: its name and what it says.

ERRNOSconst
const ERRNOS: readonly ["EACCES", "EBADF", "EEXIST", "EFBIG", "EINVAL", "EIO", "EISDIR", "ENAMETOOLONG", "ENOENT", "ENOTDIR", "ENOTEMPTY", "ENOTSUP", "EROFS", "ESTALE", "EXDEV"]

The codes, in the order of their names.

Imported by 15 tests of the run (15 passed, 0 failed): the library's results

Errnotypeno test imports it
type Errno = (typeof ERRNOS)[number];

One code.

ERRNO_NUMBERconst
const ERRNO_NUMBER: Readonly<Record<"EACCES" | "EBADF" | "EEXIST" | "EFBIG" | "EINVAL" | "EIO" | "EISDIR" | "ENAMETOOLONG" | "ENOENT" | "ENOTDIR" | "ENOTEMPTY" | "ENOTSUP" | "EROFS" | "ESTALE" | "EXDEV", number>>

The number Linux gives each code: a registry with one entry for each code, which the compiler holds.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

ERRNO_SUMMARYconst
const ERRNO_SUMMARY: Readonly<Record<"EACCES" | "EBADF" | "EEXIST" | "EFBIG" | "EINVAL" | "EIO" | "EISDIR" | "ENAMETOOLONG" | "ENOENT" | "ENOTDIR" | "ENOTEMPTY" | "ENOTSUP" | "EROFS" | "ESTALE" | "EXDEV", string>>

What each code says, in a sentence.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

isErrnofunction
function isErrno(text: string): text is "EACCES" | "EBADF" | "EEXIST" | "EFBIG" | "EINVAL" | "EIO" | "EISDIR" | "ENAMETOOLONG" | "ENOENT" | "ENOTDIR" | "ENOTEMPTY" | "ENOTSUP" | "EROFS" | "ESTALE" | "EXDEV"

Whether a text is the name of a code.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

describeErrnofunction
function describeErrno(errno: "EACCES" | "EBADF" | "EEXIST" | "EFBIG" | "EINVAL" | "EIO" | "EISDIR" | "ENAMETOOLONG" | "ENOENT" | "ENOTDIR" | "ENOTEMPTY" | "ENOTSUP" | "EROFS" | "ESTALE" | "EXDEV"): string

A code in a few words: its name and what it says.

Imported by 8 tests of the run (8 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.