Skip to content
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

Creating peer without network connection crashes an app #6

Open
VladSalat666 opened this issue May 22, 2020 · 0 comments
Open

Creating peer without network connection crashes an app #6

VladSalat666 opened this issue May 22, 2020 · 0 comments

Comments

@VladSalat666
Copy link

Hi

If there is no network connection, folowing code crashes an app:

let peer = peerJs(id, {
	host: 'example.com',
	port: 443,
	debug: 0,
	secure: true,
	pingInterval: 5000,
	config: {
		iceServers: [
			{ urls: ['stun:stun.l.example.com:1245'] },
			{ urls: ['turn:[email protected]:1234'], username: 'user', credential: 'root' }
		]
	}
});

Even trycatch can't handle this error...

events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND example.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26)
Emitted 'error' event on WebSocket instance at:
    at ClientRequest.<anonymous> (/Users/node_modules/ws/lib/websocket.js:554:15)
    at ClientRequest.emit (events.js:210:5)
    at TLSSocket.socketErrorListener (_http_client.js:406:9)
    at TLSSocket.emit (events.js:210:5)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: 'ENOTFOUND',
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'example.com'
}

host replaced by example.com, with right host and network connection all works good

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

No branches or pull requests

1 participant