Utilities

util.getSystemErrorMap()

Returns a mapping of numeric system error identifiers to names and descriptions. Values can differ by platform; prefer error.code for portable branching. The example uses a synthetic lookup by symbolic name rather than printing host-specific numbers. Tested on Node.js 22.16.0. Example output (one line per entry): ["true"].

Formal Syntax & Structure

nodejs syntaxnodejs
util.getSystemErrorMap()

Return Value

Map

System error information.

Working Example

Example Snippetnodejs
import { getSystemErrorMap } from 'node:util';console.log([...getSystemErrorMap().values()].some(([name]) => name === 'ENOENT'));
Node.js Reference