Skip to content

Commit

Permalink
fix(log): Handle case when error code is missing (#303)
Browse files Browse the repository at this point in the history
# 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)
```
  • Loading branch information
sorin-davidoi authored and chimurai committed Nov 25, 2018
1 parent 029c99d commit ab485dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Expand Up @@ -147,6 +147,6 @@ function HttpProxyMiddleware (context, opts) {
var errorMessage = '[HPM] Error occurred while trying to proxy request %s from %s to %s (%s) (%s)'
var errReference = 'https://nodejs.org/api/errors.html#errors_common_system_errors' // link to Node Common Systems Errors page

logger.error(errorMessage, req.url, hostname, target, err.code, errReference)
logger.error(errorMessage, req.url, hostname, target, err.code || err, errReference)
}
}

0 comments on commit ab485dd

Please sign in to comment.