peerjs icon indicating copy to clipboard operation
peerjs copied to clipboard

Error is fired without 'type'

Open AlonBru opened this issue 2 years ago • 3 comments

Reproduction:

  • create 2 peers peerA and peerB
  • add to peer B 'open' event listener to have a way store data connection on open and add 'error' listener on the dataConnection
  • connect with peerA to peerB, then close the connection immediately.
  • try using connection.send() from peerB

Result: Receiving these errors, however they do not seem to have a defined 'type' property as image

Expectation: As per the docs for peer errors, these errors should also have a 'type' so as to allow to better handle them in code

AlonBru avatar Jan 28 '23 22:01 AlonBru

The docs refer to the 'error' event on the Peer instance, not on the data connection. Those currently don’t have a type property.

This is not directly a bug, but I see that this is confusing and poorly documented. We’ll add them eventually.

jonasgloning avatar Jan 29 '23 13:01 jonasgloning

Thanks for the quick reply. To clarify my positiosn, I understand the docs refer to the Peer 'error' event, my suggestion is for the dataConnection to follow a similar pattern.

AlonBru avatar Jan 29 '23 13:01 AlonBru

I have created #1029 to address this

AlonBru avatar Jan 29 '23 15:01 AlonBru