diff --git a/doc/api/util.md b/doc/api/util.md index ab634380c3c406..e52c54176da014 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -376,6 +376,25 @@ fs.access('file/that/does/not/exist', (err) => { }); ``` +## `util.getSystemErrorMap()` + + +* Returns: {Map} + +Returns a Map of all system error codes available from the Node.js API. +The mapping between error codes and error names is platform-dependent. +See [Common System Errors][] for the names of common errors. + +```js +fs.access('file/that/does/not/exist', (err) => { + const errorMap = util.getSystemErrorMap(); + const name = errorMap.get(err.errno); + console.error(name); // ENOENT +}); +``` + ## `util.inherits(constructor, superConstructor)`