Webrtc-pc: RTCPeerConnection constructor can fail - what error to return?

Created on 23 Nov 2017  路  8Comments  路  Source: w3c/webrtc-pc

Observed in practice:
It's possible that we can't create an RTCPeerConnection because of lack of resources.
But the description in section 4.4.1.1 doesn't describe any error to return for this case.

Suggested fix:
Add before step 2:

"If resources to create the RTCPeerConnection object are not present at this or any subsequent step, throw <some error>"

PR exists

Most helpful comment

UnknownError seems OK with me - "something went wrong, and we're not telling".

All 8 comments

candidate errors:

  • UnknownError: "The operation failed for an unknown transient reason (e.g. out of memory)."
  • OperationError: "The operation failed for an operation-specific reason."

UnknownError seems OK with me - "something went wrong, and we're not telling".

Agreed. If the vendor cannot even describe the error, it's better to expose as "unknown error".

Apparently we need to implement something like this soon in Firefox. UnknownError works for me - more details are most likely not going to be helpful to the application anyway, as it doesn't have much control over the browsers resources directly.

more details are most likely not going to be helpful to the application anyway, as it doesn't have much control over the browsers resources directly.

Actually, if the creation fails for lack of resources - it would be pretty useful to know. I open several connections to peers to exchange data (with DataChannels) and it would be useful to know that we should not attempt to re-open the connection if opening it fails.

Specifically, it would be useful if the error described that since resources are exhausted a connection should not be opened again (until other connections are closed).

If "Lack of resources" means out of memory in this case - I can't do anything useful anyway, but if it means another form of limitation it would be useful to know to not attempt creating another connection.

FWIW the limit in Firefox would likely be arbitrary.

Was this page helpful?
0 / 5 - 0 ratings