Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Unified Diff: third_party/WebKit/Source/modules/mediastream/MediaErrorState.cpp

Issue 1661493002: Add promise-based addIceCandidate, setLocalDescription and setRemoteDescription to RTCPeerConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: philipj's comments on tests Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/mediastream/MediaErrorState.cpp
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaErrorState.cpp b/third_party/WebKit/Source/modules/mediastream/MediaErrorState.cpp
index e52cb024b24b232a91e2dc1463b408fd14639a1d..1480b0e6480bc3c4a553f6a11cd760ac5791b4c4 100644
--- a/third_party/WebKit/Source/modules/mediastream/MediaErrorState.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/MediaErrorState.cpp
@@ -49,7 +49,7 @@ void MediaErrorState::throwTypeError(const String& message)
void MediaErrorState::throwDOMException(const ExceptionCode& code, const String& message)
{
- m_errorType = DOMError;
+ m_errorType = DOMException;
m_code = code;
m_message = message;
}
@@ -73,7 +73,7 @@ bool MediaErrorState::hadException()
bool MediaErrorState::canGenerateException()
{
- return m_errorType == TypeError || m_errorType == DOMError;
+ return m_errorType == TypeError || m_errorType == DOMException;
}
void MediaErrorState::raiseException(ExceptionState& target)
@@ -85,7 +85,7 @@ void MediaErrorState::raiseException(ExceptionState& target)
case TypeError:
target.throwTypeError(m_message);
break;
- case DOMError:
+ case DOMException:
target.throwDOMException(m_code, m_message);
break;
case ConstraintError:
@@ -96,7 +96,32 @@ void MediaErrorState::raiseException(ExceptionState& target)
// TODO(hta): Remove this code. https://crbug.com/576581
target.throwDOMException(NotSupportedError, "Unsatisfiable constraint " + m_constraint);
break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+
+String MediaErrorState::getErrorMessage()
+{
+ switch (m_errorType) {
+ case NoError:
+ ASSERT_NOT_REACHED();
+ break;
+ case TypeError:
+ case DOMException:
+ return m_message;
+ case ConstraintError:
+ // This is for the cases where we can't pass back a
+ // NavigatorUserMediaError.
+ // So far, we have this in the constructor of RTCPeerConnection,
+ // which is due to be deprecated.
+ // TODO(hta): Remove this code. https://crbug.com/576581
+ return "Unsatisfiable constraint " + m_constraint;
+ default:
+ ASSERT_NOT_REACHED();
}
+
+ return String();
}
NavigatorUserMediaError* MediaErrorState::createError()

Powered by Google App Engine
This is Rietveld 408576698