Skip to content

Log err.reason when no err.code is availiable #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

zbycz
Copy link

@zbycz zbycz commented Apr 27, 2018

When connecting to https resource, the error can have no code. Lets display err.reason instead

ie.:

err { Error: Hostname/IP doesn't match certificate's altnames: "Host: localhost. is not in the cert's altnames: DNS:..."
    at Object.checkServerIdentity (tls.js:222:17)
    at TLSSocket.<anonymous> (_tls_wrap.js:1109:29)
    at emitNone (events.js:106:13)
    at TLSSocket.emit (events.js:208:7)
    at TLSSocket._finishInit (_tls_wrap.js:637:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38)
  reason: 'Host: localhost. is not in the cert\'s altnames: DNS:...,
  host: 'localhost',
  cert: ...

Otherwise the log looks like this: (see (undefined))

[HPM] Error occurred while trying to proxy request /url/sth/sth from localhost:3009 to https://example.com (undefined) (https://nodejs.org/api/errors.html#errors_common_system_errors)

@coveralls
Copy link

coveralls commented Apr 27, 2018

Coverage Status

Coverage remained the same at 97.067% when pulling 1e8d788 on zbycz:patch-1 into 952c1af on chimurai:master.

@brettdh
Copy link

brettdh commented Nov 20, 2018

Maintainers, please review and merge; I struggled with this today and ended up tracking down the same issue and locally fixing to diagnose the same cert issue (missing "changeOrigin": true in config).

@chimurai
Copy link
Owner

merged in #263

@chimurai chimurai closed this Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants