Convert libwebrtc error types to DOM exceptions
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2018 17:53:21 +0000 (17:53 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2018 17:53:21 +0000 (17:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191590

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/RTCConfiguration-rtcpMuxPolicy-expected.txt:
* web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt:
* web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt:

Source/ThirdParty/libwebrtc:

* Configurations/libwebrtc.iOS.exp:
* Configurations/libwebrtc.iOSsim.exp:
* Configurations/libwebrtc.mac.exp:

Source/WebCore:

Make use of overloaded callback method that provides an error type.
This type is then used to create a DOM exception with the correct type.
Covered by existing tests.

* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
(WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
(WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
(WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
* Modules/mediastream/libwebrtc/LibWebRTCObservers.h:
(WebCore::toExceptionCode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238182 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCConfiguration-rtcpMuxPolicy-expected.txt
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt
Source/ThirdParty/libwebrtc/ChangeLog
Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp
Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp
Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCObservers.h

index e4b008a..af5ee23 100644 (file)
@@ -1,5 +1,16 @@
 2018-11-14  Youenn Fablet  <youenn@apple.com>
 
+        Convert libwebrtc error types to DOM exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=191590
+
+        Reviewed by Alex Christensen.
+
+        * web-platform-tests/webrtc/RTCConfiguration-rtcpMuxPolicy-expected.txt:
+        * web-platform-tests/webrtc/RTCPeerConnection-setLocalDescription-answer-expected.txt:
+        * web-platform-tests/webrtc/RTCRtpTransceiver.https-expected.txt:
+
+2018-11-14  Youenn Fablet  <youenn@apple.com>
+
         Calling removeTrack on different RTCPeerConnection should throw InvalidAccessError
         https://bugs.webkit.org/show_bug.cgi?id=191603
 
index 6dd6362..0e78fde 100644 (file)
@@ -10,6 +10,6 @@ PASS setConfiguration(config) - with { rtcpMuxPolicy: 'invalid' } should throw T
 PASS setConfiguration({ rtcpMuxPolicy: 'negotiate' }) with initial rtcpMuxPolicy require should throw InvalidModificationError 
 PASS setConfiguration({ rtcpMuxPolicy: 'require' }) with initial rtcpMuxPolicy negotiate should throw InvalidModificationError 
 PASS setConfiguration({}) with initial rtcpMuxPolicy negotiate should throw InvalidModificationError 
-FAIL setRemoteDescription throws InvalidAccessError when called with an offer without rtcp-mux and rtcpMuxPolicy is set to require assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set remote offer sdp: The m= section:audio1 is invalid. RTCP-MUX is not enabled when it is required." that is not a DOMException InvalidAccessError: property "code" is equal to 0, expected 15
-FAIL setRemoteDescription throws InvalidAccessError when called with an answer without rtcp-mux and rtcpMuxPolicy is set to require assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set remote answer sdp: The order of m-lines in answer doesn't match order in offer. Rejecting answer." that is not a DOMException InvalidAccessError: property "code" is equal to 0, expected 15
+PASS setRemoteDescription throws InvalidAccessError when called with an offer without rtcp-mux and rtcpMuxPolicy is set to require 
+PASS setRemoteDescription throws InvalidAccessError when called with an answer without rtcp-mux and rtcpMuxPolicy is set to require 
 
index 1ba1bee..8a04b5d 100644 (file)
@@ -1,7 +1,7 @@
 
 PASS setLocalDescription() with valid answer should succeed 
 FAIL setLocalDescription() with type answer and null sdp should use lastAnswer generated from createAnswer promise_test: Unhandled rejection with value: object "OperationError: Expect line: v="
-FAIL setLocalDescription() with answer not created by own createAnswer() should reject with InvalidModificationError assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local answer sdp: Failed to apply the description for 0: Local fingerprint does not match identity. Expected: sha-256 12:E5:12:50:9C:09:A8:71:EF:5F:AF:F6:4C:08:7A:BF:0C:44:2D:A8:96:5C:34:3A:64:12:70:D2:51:60:2E:79 Got: sha-256 A5:C7:8C:82:7E:30:00:63:86:E5:AA:93:65:C2:60:83:49:01:E0:35:0F:91:F2:7A:C3:7B:AF:8F:52:3E:12:87" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13
+FAIL setLocalDescription() with answer not created by own createAnswer() should reject with InvalidModificationError assert_throws: function "function () { throw e }" threw object "OperationError: Failed to set local answer sdp: Failed to apply the description for 0: Local fingerprint does not match identity. Expected: sha-256 FD:12:D4:3F:20:8C:37:A8:9A:C0:CB:03:84:DF:97:20:40:24:C8:DB:B8:88:6C:8D:99:B6:25:48:5C:29:1E:0B Got: sha-256 CC:EB:A3:0C:D3:6C:7C:66:8B:E2:C8:A7:7B:00:92:56:A6:C8:C9:3E:D8:B9:CB:D0:5A:C9:7F:AE:10:4E:C7:CA" that is not a DOMException InvalidModificationError: property "code" is equal to 0, expected 13
 PASS Calling setLocalDescription(answer) from stable state should reject with InvalidStateError 
 PASS Calling setLocalDescription(answer) from have-local-offer state should reject with InvalidStateError 
 
index bd6e47d..e8df9b1 100644 (file)
@@ -8,7 +8,7 @@ PASS checkAddTransceiverWithDirection
 PASS checkAddTransceiverWithSetRemoteOfferSending 
 PASS checkAddTransceiverWithSetRemoteOfferNoSend 
 PASS checkAddTransceiverBadKind 
-FAIL checkNoMidOffer promise_test: Unhandled rejection with value: object "OperationError: Failed to set remote offer sdp: The BUNDLE group contains MID:0 matching no m= section."
+FAIL checkNoMidOffer promise_test: Unhandled rejection with value: object "InvalidAccessError: Failed to set remote offer sdp: The BUNDLE group contains MID:0 matching no m= section."
 PASS checkSetDirection 
 PASS checkCurrentDirection 
 PASS checkSendrecvWithNoSendTrack 
index 080c384..56d92ef 100644 (file)
@@ -1,5 +1,16 @@
 2018-11-14  Youenn Fablet  <youenn@apple.com>
 
+        Convert libwebrtc error types to DOM exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=191590
+
+        Reviewed by Alex Christensen.
+
+        * Configurations/libwebrtc.iOS.exp:
+        * Configurations/libwebrtc.iOSsim.exp:
+        * Configurations/libwebrtc.mac.exp:
+
+2018-11-14  Youenn Fablet  <youenn@apple.com>
+
         Add support for transport and peerConnection stats
         https://bugs.webkit.org/show_bug.cgi?id=191592
 
index 5c69b88..d95d51e 100644 (file)
@@ -129,8 +129,6 @@ __ZTVN6webrtc29SetSessionDescriptionObserverE
 __ZNK3rtc17ThreadCheckerImpl19CalledOnValidThreadEv
 __ZN7cricket18BasicPortAllocatorC1EPN3rtc14NetworkManagerEPNS1_19PacketSocketFactoryEPN6webrtc14TurnCustomizerEPNS_25RelayPortFactoryInterfaceE
 __ZN7cricket12AudioOptionsD1Ev
-__ZN6webrtc32CreateSessionDescriptionObserver9OnFailureENS_8RTCErrorE
-__ZN6webrtc29SetSessionDescriptionObserver9OnFailureENS_8RTCErrorE
 __ZN6webrtc28RtpHeaderExtensionCapabilityD1Ev
 __ZN6webrtc26PeerConnectionDependenciesD1Ev
 __ZN3rtc24BasicPacketSocketFactory21CreateClientTcpSocketERKNS_13SocketAddressES3_RKNS_9ProxyInfoERKNSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEERKNS_22PacketSocketTcpOptionsE
@@ -233,3 +231,5 @@ __ZNK3rtc14SSLCertificate8GetStatsEv
 __ZN3rtc14RTCCertificate7FromPEMERKNS_17RTCCertificatePEME
 __ZN6webrtc26PeerConnectionDependenciesC1EPNS_22PeerConnectionObserverE
 __ZN6webrtc30PeerConnectionFactoryInterface20CreatePeerConnectionERKNS_23PeerConnectionInterface16RTCConfigurationENSt3__110unique_ptrIN7cricket13PortAllocatorENS5_14default_deleteIS8_EEEENS6_IN3rtc32RTCCertificateGeneratorInterfaceENS9_ISD_EEEEPNS_22PeerConnectionObserverE
+__ZN6webrtc29SetSessionDescriptionObserver9OnFailureERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
+__ZN6webrtc32CreateSessionDescriptionObserver9OnFailureERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
index f4587da..19d0fe6 100644 (file)
@@ -129,8 +129,6 @@ __ZTVN6webrtc29SetSessionDescriptionObserverE
 __ZNK3rtc17ThreadCheckerImpl19CalledOnValidThreadEv
 __ZN7cricket18BasicPortAllocatorC1EPN3rtc14NetworkManagerEPNS1_19PacketSocketFactoryEPN6webrtc14TurnCustomizerEPNS_25RelayPortFactoryInterfaceE
 __ZN7cricket12AudioOptionsD1Ev
-__ZN6webrtc32CreateSessionDescriptionObserver9OnFailureENS_8RTCErrorE
-__ZN6webrtc29SetSessionDescriptionObserver9OnFailureENS_8RTCErrorE
 __ZN6webrtc28RtpHeaderExtensionCapabilityD1Ev
 __ZN6webrtc26PeerConnectionDependenciesD1Ev
 __ZN3rtc24BasicPacketSocketFactory21CreateClientTcpSocketERKNS_13SocketAddressES3_RKNS_9ProxyInfoERKNSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEERKNS_22PacketSocketTcpOptionsE
@@ -234,3 +232,5 @@ __ZNK3rtc14SSLCertificate8GetStatsEv
 __ZN3rtc14RTCCertificate7FromPEMERKNS_17RTCCertificatePEME
 __ZN6webrtc26PeerConnectionDependenciesC1EPNS_22PeerConnectionObserverE
 __ZN6webrtc30PeerConnectionFactoryInterface20CreatePeerConnectionERKNS_23PeerConnectionInterface16RTCConfigurationENSt3__110unique_ptrIN7cricket13PortAllocatorENS5_14default_deleteIS8_EEEENS6_IN3rtc32RTCCertificateGeneratorInterfaceENS9_ISD_EEEEPNS_22PeerConnectionObserverE
+__ZN6webrtc29SetSessionDescriptionObserver9OnFailureERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
+__ZN6webrtc32CreateSessionDescriptionObserver9OnFailureERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
index f4587da..19d0fe6 100644 (file)
@@ -129,8 +129,6 @@ __ZTVN6webrtc29SetSessionDescriptionObserverE
 __ZNK3rtc17ThreadCheckerImpl19CalledOnValidThreadEv
 __ZN7cricket18BasicPortAllocatorC1EPN3rtc14NetworkManagerEPNS1_19PacketSocketFactoryEPN6webrtc14TurnCustomizerEPNS_25RelayPortFactoryInterfaceE
 __ZN7cricket12AudioOptionsD1Ev
-__ZN6webrtc32CreateSessionDescriptionObserver9OnFailureENS_8RTCErrorE
-__ZN6webrtc29SetSessionDescriptionObserver9OnFailureENS_8RTCErrorE
 __ZN6webrtc28RtpHeaderExtensionCapabilityD1Ev
 __ZN6webrtc26PeerConnectionDependenciesD1Ev
 __ZN3rtc24BasicPacketSocketFactory21CreateClientTcpSocketERKNS_13SocketAddressES3_RKNS_9ProxyInfoERKNSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEERKNS_22PacketSocketTcpOptionsE
@@ -234,3 +232,5 @@ __ZNK3rtc14SSLCertificate8GetStatsEv
 __ZN3rtc14RTCCertificate7FromPEMERKNS_17RTCCertificatePEME
 __ZN6webrtc26PeerConnectionDependenciesC1EPNS_22PeerConnectionObserverE
 __ZN6webrtc30PeerConnectionFactoryInterface20CreatePeerConnectionERKNS_23PeerConnectionInterface16RTCConfigurationENSt3__110unique_ptrIN7cricket13PortAllocatorENS5_14default_deleteIS8_EEEENS6_IN3rtc32RTCCertificateGeneratorInterfaceENS9_ISD_EEEEPNS_22PeerConnectionObserverE
+__ZN6webrtc29SetSessionDescriptionObserver9OnFailureERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
+__ZN6webrtc32CreateSessionDescriptionObserver9OnFailureERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
index 144009b..2261456 100644 (file)
@@ -1,5 +1,25 @@
 2018-11-14  Youenn Fablet  <youenn@apple.com>
 
+        Convert libwebrtc error types to DOM exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=191590
+
+        Reviewed by Alex Christensen.
+
+        Make use of overloaded callback method that provides an error type.
+        This type is then used to create a DOM exception with the correct type.
+        Covered by existing tests.
+
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+        (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
+        (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
+        (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
+        (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
+        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
+        * Modules/mediastream/libwebrtc/LibWebRTCObservers.h:
+        (WebCore::toExceptionCode):
+
+2018-11-14  Youenn Fablet  <youenn@apple.com>
+
         Allow to remove MediaStreamPrivate observers when iterating over observers
         https://bugs.webkit.org/show_bug.cgi?id=187256
 
index 85219b0..7c85d97 100644 (file)
@@ -193,7 +193,7 @@ void LibWebRTCMediaEndpoint::doSetRemoteDescription(RTCSessionDescription& descr
     webrtc::SdpParseError error;
     std::unique_ptr<webrtc::SessionDescriptionInterface> sessionDescription(webrtc::CreateSessionDescription(sessionDescriptionType(description.type()), description.sdp().utf8().data(), &error));
     if (!sessionDescription) {
-        m_peerConnectionBackend.setRemoteDescriptionFailed(Exception { OperationError, fromStdString(error.description) });
+        m_peerConnectionBackend.setRemoteDescriptionFailed(Exception { SyntaxError, fromStdString(error.description) });
         return;
     }
     m_backend->SetRemoteDescription(&m_setRemoteSessionDescriptionObserver, sessionDescription.release());
@@ -772,15 +772,15 @@ void LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded(std::unique_ptr<w
     });
 }
 
-void LibWebRTCMediaEndpoint::createSessionDescriptionFailed(const std::string& errorMessage)
+void LibWebRTCMediaEndpoint::createSessionDescriptionFailed(ExceptionCode errorCode, const char* errorMessage)
 {
-    callOnMainThread([protectedThis = makeRef(*this), error = fromStdString(errorMessage)] () mutable {
+    callOnMainThread([protectedThis = makeRef(*this), errorCode, errorMessage = String(errorMessage)] () mutable {
         if (protectedThis->isStopped())
             return;
         if (protectedThis->m_isInitiator)
-            protectedThis->m_peerConnectionBackend.createOfferFailed(Exception { OperationError, WTFMove(error) });
+            protectedThis->m_peerConnectionBackend.createOfferFailed(Exception { errorCode, WTFMove(errorMessage) });
         else
-            protectedThis->m_peerConnectionBackend.createAnswerFailed(Exception { OperationError, WTFMove(error) });
+            protectedThis->m_peerConnectionBackend.createAnswerFailed(Exception { errorCode, WTFMove(errorMessage) });
     });
 }
 
@@ -793,12 +793,12 @@ void LibWebRTCMediaEndpoint::setLocalSessionDescriptionSucceeded()
     });
 }
 
-void LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed(const std::string& errorMessage)
+void LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed(ExceptionCode errorCode, const char* errorMessage)
 {
-    callOnMainThread([protectedThis = makeRef(*this), error = fromStdString(errorMessage)] () mutable {
+    callOnMainThread([protectedThis = makeRef(*this), errorCode, errorMessage = String(errorMessage)] () mutable {
         if (protectedThis->isStopped())
             return;
-        protectedThis->m_peerConnectionBackend.setLocalDescriptionFailed(Exception { OperationError, WTFMove(error) });
+        protectedThis->m_peerConnectionBackend.setLocalDescriptionFailed(Exception { errorCode, WTFMove(errorMessage) });
     });
 }
 
@@ -811,12 +811,12 @@ void LibWebRTCMediaEndpoint::setRemoteSessionDescriptionSucceeded()
     });
 }
 
-void LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed(const std::string& errorMessage)
+void LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed(ExceptionCode errorCode, const char* errorMessage)
 {
-    callOnMainThread([protectedThis = makeRef(*this), error = fromStdString(errorMessage)] () mutable {
+    callOnMainThread([protectedThis = makeRef(*this), errorCode, errorMessage = String(errorMessage)] () mutable {
         if (protectedThis->isStopped())
             return;
-        protectedThis->m_peerConnectionBackend.setRemoteDescriptionFailed(Exception { OperationError, WTFMove(error) });
+        protectedThis->m_peerConnectionBackend.setRemoteDescriptionFailed(Exception { errorCode, WTFMove(errorMessage) });
     });
 }
 
index 5e21082..41cd884 100644 (file)
@@ -132,11 +132,11 @@ private:
     void OnIceCandidatesRemoved(const std::vector<cricket::Candidate>&) final;
 
     void createSessionDescriptionSucceeded(std::unique_ptr<webrtc::SessionDescriptionInterface>&&);
-    void createSessionDescriptionFailed(const std::string&);
+    void createSessionDescriptionFailed(ExceptionCode, const char*);
     void setLocalSessionDescriptionSucceeded();
-    void setLocalSessionDescriptionFailed(const std::string&);
+    void setLocalSessionDescriptionFailed(ExceptionCode, const char*);
     void setRemoteSessionDescriptionSucceeded();
-    void setRemoteSessionDescriptionFailed(const std::string&);
+    void setRemoteSessionDescriptionFailed(ExceptionCode, const char*);
     void addRemoteStream(webrtc::MediaStreamInterface&);
     void addRemoteTrack(rtc::scoped_refptr<webrtc::RtpReceiverInterface>&&, const std::vector<rtc::scoped_refptr<webrtc::MediaStreamInterface>>&);
     void removeRemoteStream(webrtc::MediaStreamInterface&);
index d199ca7..da92b31 100644 (file)
@@ -26,6 +26,7 @@
 
 #if USE(LIBWEBRTC)
 
+#include "ExceptionCode.h"
 #include "LibWebRTCMacros.h"
 
 ALLOW_UNUSED_PARAMETERS_BEGIN
@@ -36,6 +37,26 @@ ALLOW_UNUSED_PARAMETERS_END
 
 namespace WebCore {
 
+static inline ExceptionCode toExceptionCode(webrtc::RTCErrorType type)
+{
+    switch (type) {
+    case webrtc::RTCErrorType::INVALID_PARAMETER:
+        return InvalidAccessError;
+    case webrtc::RTCErrorType::INVALID_RANGE:
+        return RangeError;
+    case webrtc::RTCErrorType::SYNTAX_ERROR:
+        return SyntaxError;
+    case webrtc::RTCErrorType::INVALID_STATE:
+        return InvalidStateError;
+    case webrtc::RTCErrorType::INVALID_MODIFICATION:
+        return InvalidModificationError;
+    case webrtc::RTCErrorType::NETWORK_ERROR:
+        return NetworkError;
+    default:
+        return OperationError;
+    }
+}
+
 template<typename Endpoint>
 class CreateSessionDescriptionObserver final : public webrtc::CreateSessionDescriptionObserver {
 public:
@@ -45,7 +66,7 @@ public:
     }
 
     void OnSuccess(webrtc::SessionDescriptionInterface* sessionDescription) final { m_endpoint.createSessionDescriptionSucceeded(std::unique_ptr<webrtc::SessionDescriptionInterface>(sessionDescription)); }
-    void OnFailure(const std::string& error) final { m_endpoint.createSessionDescriptionFailed(error); }
+    void OnFailure(webrtc::RTCError error) final { m_endpoint.createSessionDescriptionFailed(toExceptionCode(error.type()), error.message()); }
 
     void AddRef() const { m_endpoint.AddRef(); }
     rtc::RefCountReleaseStatus Release() const { return m_endpoint.Release(); }
@@ -63,7 +84,7 @@ public:
     }
 
     void OnSuccess() final { m_endpoint.setLocalSessionDescriptionSucceeded(); }
-    void OnFailure(const std::string& error) final { m_endpoint.setLocalSessionDescriptionFailed(error); }
+    void OnFailure(webrtc::RTCError error) final { m_endpoint.setLocalSessionDescriptionFailed(toExceptionCode(error.type()), error.message()); }
 
     void AddRef() const { m_endpoint.AddRef(); }
     rtc::RefCountReleaseStatus Release() const { return m_endpoint.Release(); }
@@ -81,7 +102,7 @@ public:
     }
 
     void OnSuccess() final { m_endpoint.setRemoteSessionDescriptionSucceeded(); }
-    void OnFailure(const std::string& error) final { m_endpoint.setRemoteSessionDescriptionFailed(error); }
+    void OnFailure(webrtc::RTCError error) final { m_endpoint.setRemoteSessionDescriptionFailed(toExceptionCode(error.type()), error.message()); }
 
     void AddRef() const { m_endpoint.AddRef(); }
     rtc::RefCountReleaseStatus Release() const { return m_endpoint.Release(); }