File tree Expand file tree Collapse file tree 2 files changed +12
-20
lines changed
Expand file tree Collapse file tree 2 files changed +12
-20
lines changed Original file line number Diff line number Diff line change @@ -327,7 +327,7 @@ function lazyUv() {
327327 return uvBinding ;
328328}
329329
330- function lazyErrmapGet ( name ) {
330+ function uvErrmapGet ( name ) {
331331 uvBinding = lazyUv ( ) ;
332332 if ( ! uvBinding . errmap ) {
333333 uvBinding . errmap = uvBinding . getErrorMap ( ) ;
@@ -346,7 +346,7 @@ function lazyErrmapGet(name) {
346346 * @returns {Error }
347347 */
348348function uvException ( ctx ) {
349- const [ code , uvmsg ] = lazyErrmapGet ( ctx . errno ) ;
349+ const [ code , uvmsg ] = uvErrmapGet ( ctx . errno ) ;
350350 let message = `${ code } : ${ ctx . message || uvmsg } , ${ ctx . syscall } ` ;
351351
352352 let path ;
@@ -404,7 +404,7 @@ function uvException(ctx) {
404404 * @returns {Error }
405405 */
406406function uvExceptionWithHostPort ( err , syscall , address , port ) {
407- const [ code , uvmsg ] = lazyErrmapGet ( err ) ;
407+ const [ code , uvmsg ] = uvErrmapGet ( err ) ;
408408 const message = `${ syscall } ${ code } : ${ uvmsg } ` ;
409409 let details = '' ;
410410
@@ -666,6 +666,7 @@ module.exports = {
666666 hideStackFrames,
667667 isStackOverflowError,
668668 connResetException,
669+ uvErrmapGet,
669670 uvException,
670671 uvExceptionWithHostPort,
671672 SystemError,
Original file line number Diff line number Diff line change 11'use strict' ;
22
33const { Object, Reflect } = primordials ;
4-
54const {
6- ERR_INVALID_ARG_TYPE ,
7- ERR_NO_CRYPTO ,
8- ERR_UNKNOWN_SIGNAL
9- } = require ( 'internal/errors' ) . codes ;
5+ codes : {
6+ ERR_INVALID_ARG_TYPE ,
7+ ERR_NO_CRYPTO ,
8+ ERR_UNKNOWN_SIGNAL
9+ } ,
10+ uvErrmapGet
11+ } = require ( 'internal/errors' ) ;
1012const { signals } = internalBinding ( 'constants' ) . os ;
1113const {
1214 getHiddenValue,
@@ -244,19 +246,8 @@ function getConstructorOf(obj) {
244246 return null ;
245247}
246248
247- let uvBinding ;
248- function lazyErrmapGet ( name ) {
249- if ( ! uvBinding ) {
250- uvBinding = internalBinding ( 'uv' ) ;
251- }
252- if ( ! uvBinding . errmap ) {
253- uvBinding . errmap = uvBinding . getErrorMap ( ) ;
254- }
255- return uvBinding . errmap . get ( name ) ;
256- }
257-
258249function getSystemErrorName ( err ) {
259- const entry = lazyErrmapGet ( err ) ;
250+ const entry = uvErrmapGet ( err ) ;
260251 return entry ? entry [ 0 ] : `Unknown system error ${ err } ` ;
261252}
262253
You can’t perform that action at this time.
0 commit comments