jaredhanson / passport-oauth1

OAuth 1.0 authentication strategy for Passport and Node.js.
https://www.passportjs.org/packages/passport-oauth1/?utm_source=github&utm_medium=referral&utm_campaign=passport-oauth1&utm_content=about
MIT License
24 stars 31 forks source link

Uncaught error event crashes process #12

Open olalonde opened 8 years ago

olalonde commented 8 years ago

I was running my server locally and my laptop accidentally connected to one of those wifis which redirects all your http(s) requests. This resulted in this error:

error:  Error: self signed certificate
    at Strategy.OAuthStrategy._createOAuthError (/Users/olalonde/code/myapp/myapp-api/node_modules/passport-oauth1/lib/strategy.js:396:17)
    at /Users/olalonde/code/myapp/myapp-api/node_modules/passport-oauth1/lib/strategy.js:244:41
    at /Users/olalonde/code/myapp/myapp-api/node_modules/oauth/lib/oauth.js:543:17
    at ClientRequest.<anonymous> (/Users/olalonde/code/myapp/myapp-api/node_modules/oauth/lib/oauth.js:421:9)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at TLSSocket.socketErrorListener (_http_client.js:306:9)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)
    at emitErrorNT (net.js:1265:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)
GET /v1/auth/connect/twitter 500 75.890 ms - 39
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: self signed certificate
    at Error (native)
    at TLSSocket.<anonymous> (_tls_wrap.js:1055:38)
    at emitNone (events.js:86:13)
    at TLSSocket.emit (events.js:185:7)
    at TLSSocket._finishInit (_tls_wrap.js:580:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:412:38)
[nodemon] app crashed - waiting for file changes before starting...

I was wondering if there would be any way to catch this error so that it doesn't crash the whole process next time.