Skip to content
6 changes: 6 additions & 0 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ function uvErrmapGet(name) {
return MapPrototypeGet(uvBinding.errmap, name);
}

function uvGetFullErrMap() {
uvBinding = lazyUv();
return uvBinding.getErrorMap();
}

const captureLargerStackTrace = hideStackFrames(
function captureLargerStackTrace(err) {
userStackTraceLimit = Error.stackTraceLimit;
Expand Down Expand Up @@ -782,6 +787,7 @@ module.exports = {
isStackOverflowError,
connResetException,
uvErrmapGet,
uvGetFullErrMap,
uvException,
uvExceptionWithHostPort,
SystemError,
Expand Down
6 changes: 6 additions & 0 deletions lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const {
ERR_UNKNOWN_SIGNAL
},
uvErrmapGet,
uvGetFullErrMap,
overrideStackTrace,
} = require('internal/errors');
const { signals } = internalBinding('constants').os;
Expand Down Expand Up @@ -286,6 +287,10 @@ function getSystemErrorName(err) {
return entry ? entry[0] : `Unknown system error ${err}`;
}

function getSystemErrorMap() {
return uvGetFullErrMap();
}
Comment thread
EladKeyshawn marked this conversation as resolved.

const kCustomPromisifiedSymbol = SymbolFor('nodejs.util.promisify.custom');
const kCustomPromisifyArgsSymbol = Symbol('customPromisifyArgs');

Expand Down Expand Up @@ -443,6 +448,7 @@ module.exports = {
filterDuplicateStrings,
getConstructorOf,
getSystemErrorName,
getSystemErrorMap,
Comment thread
EladKeyshawn marked this conversation as resolved.
isError,
isInsideNodeModules,
join,
Expand Down
5 changes: 5 additions & 0 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const types = require('internal/util/types');
const {
deprecate,
getSystemErrorName: internalErrorName,
getSystemErrorMap: internalErrorMap,
promisify
} = require('internal/util');

Expand Down Expand Up @@ -245,6 +246,9 @@ function getSystemErrorName(err) {
return internalErrorName(err);
}

Comment thread
EladKeyshawn marked this conversation as resolved.
function getSystemErrorMap() {
return internalErrorMap();
}
Comment thread
EladKeyshawn marked this conversation as resolved.
Outdated
// Keep the `exports =` so that various functions can still be monkeypatched
module.exports = {
_errnoException: errnoException,
Expand All @@ -257,6 +261,7 @@ module.exports = {
format,
formatWithOptions,
getSystemErrorName,
getSystemErrorMap,
Comment thread
EladKeyshawn marked this conversation as resolved.
inherits,
inspect,
isArray: ArrayIsArray,
Expand Down