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

Unified Diff: Source/bindings/v8/ExceptionState.h

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, 8 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: Source/bindings/v8/ExceptionState.h
diff --git a/Source/bindings/v8/ExceptionState.h b/Source/bindings/v8/ExceptionState.h
index d9c2b05b8efbf964243352d5fbea2f0cb792aa08..e09e223f8ea44d7d7a4b8fd5aaa7e585eaffe7bd 100644
--- a/Source/bindings/v8/ExceptionState.h
+++ b/Source/bindings/v8/ExceptionState.h
@@ -32,6 +32,7 @@
#define ExceptionState_h
#include "bindings/v8/ScopedPersistent.h"
+#include "bindings/v8/ScriptPromise.h"
#include "bindings/v8/V8ThrowException.h"
#include "wtf/Noncopyable.h"
#include "wtf/text/WTFString.h"
@@ -92,6 +93,13 @@ public:
return true;
}
+ ScriptPromise rejectedPromise()
haraken 2014/04/10 12:09:17 Shall we just call it "reject", just like other re
yhirano 2014/04/11 10:19:04 Done.
+ {
+ if (hadException())
+ return ScriptPromise::reject(m_exception.newLocal(m_isolate), m_isolate);
+ return ScriptPromise::reject(V8ThrowException::createError(v8GeneralError, "Unknown Error", m_isolate), m_isolate);
+ }
+
Context context() const { return m_context; }
const char* propertyName() const { return m_propertyName; }
const char* interfaceName() const { return m_interfaceName; }

Powered by Google App Engine
This is Rietveld 408576698