Skip to content

Commit ab485dd

Browse files
sorin-davidoichimurai
authored andcommitted
fix(log): Handle case when error code is missing (#303)
# Before ``` HPM] Error occurred while trying to proxy request <redacted> from <redacted> to <redacted> (undefined) (https://nodejs.org/api/errors.html#errors_common_system_errors) ``` # After ``` [HPM] Error occurred while trying to proxy request <redacted> from <redacted> to <redacted> (Error: Hostname/IP doesn't match certificate's altnames: "Host: <redacted>. is not in the cert's altnames: DNS:<redacted>, DNS:<redacted>") (https://nodejs.org/api/errors.html#errors_common_system_errors) ```
1 parent 029c99d commit ab485dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,6 @@ function HttpProxyMiddleware (context, opts) {
147147
var errorMessage = '[HPM] Error occurred while trying to proxy request %s from %s to %s (%s) (%s)'
148148
var errReference = 'https://nodejs.org/api/errors.html#errors_common_system_errors' // link to Node Common Systems Errors page
149149

150-
logger.error(errorMessage, req.url, hostname, target, err.code, errReference)
150+
logger.error(errorMessage, req.url, hostname, target, err.code || err, errReference)
151151
}
152152
}

0 commit comments

Comments
 (0)