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

Unified Diff: Source/bindings/core/v8/ExceptionState.cpp

Issue 232563003: API functions returning Promises should not throw exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « Source/bindings/core/v8/ExceptionState.h ('k') | Source/bindings/core/v8/ScriptPromise.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ExceptionState.cpp
diff --git a/Source/bindings/core/v8/ExceptionState.cpp b/Source/bindings/core/v8/ExceptionState.cpp
index 9db47f6be4bda2625aa6a4b48a73e22dda3f060d..f54d7a15b70304faaa317a651a94eedb770fe200 100644
--- a/Source/bindings/core/v8/ExceptionState.cpp
+++ b/Source/bindings/core/v8/ExceptionState.cpp
@@ -43,6 +43,13 @@ void ExceptionState::clearException()
m_exception.clear();
}
+ScriptPromise ExceptionState::reject(ScriptState* scriptState)
+{
+ ScriptPromise promise = ScriptPromise::reject(scriptState, m_exception.newLocal(scriptState->isolate()));
+ clearException();
+ return promise;
+}
+
void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& message)
{
ASSERT(ec);
« no previous file with comments | « Source/bindings/core/v8/ExceptionState.h ('k') | Source/bindings/core/v8/ScriptPromise.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698