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() {
327
327
return uvBinding ;
328
328
}
329
329
330
- function lazyErrmapGet ( name ) {
330
+ function uvErrmapGet ( name ) {
331
331
uvBinding = lazyUv ( ) ;
332
332
if ( ! uvBinding . errmap ) {
333
333
uvBinding . errmap = uvBinding . getErrorMap ( ) ;
@@ -346,7 +346,7 @@ function lazyErrmapGet(name) {
346
346
* @returns {Error }
347
347
*/
348
348
function uvException ( ctx ) {
349
- const [ code , uvmsg ] = lazyErrmapGet ( ctx . errno ) ;
349
+ const [ code , uvmsg ] = uvErrmapGet ( ctx . errno ) ;
350
350
let message = `${ code } : ${ ctx . message || uvmsg } , ${ ctx . syscall } ` ;
351
351
352
352
let path ;
@@ -404,7 +404,7 @@ function uvException(ctx) {
404
404
* @returns {Error }
405
405
*/
406
406
function uvExceptionWithHostPort ( err , syscall , address , port ) {
407
- const [ code , uvmsg ] = lazyErrmapGet ( err ) ;
407
+ const [ code , uvmsg ] = uvErrmapGet ( err ) ;
408
408
const message = `${ syscall } ${ code } : ${ uvmsg } ` ;
409
409
let details = '' ;
410
410
@@ -666,6 +666,7 @@ module.exports = {
666
666
hideStackFrames,
667
667
isStackOverflowError,
668
668
connResetException,
669
+ uvErrmapGet,
669
670
uvException,
670
671
uvExceptionWithHostPort,
671
672
SystemError,
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
const { Object, Reflect } = primordials ;
4
-
5
4
const {
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' ) ;
10
12
const { signals } = internalBinding ( 'constants' ) . os ;
11
13
const {
12
14
getHiddenValue,
@@ -244,19 +246,8 @@ function getConstructorOf(obj) {
244
246
return null ;
245
247
}
246
248
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
-
258
249
function getSystemErrorName ( err ) {
259
- const entry = lazyErrmapGet ( err ) ;
250
+ const entry = uvErrmapGet ( err ) ;
260
251
return entry ? entry [ 0 ] : `Unknown system error ${ err } ` ;
261
252
}
262
253
You can’t perform that action at this time.
0 commit comments