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

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..bd4ee703b55928c521c7a78c2d775eb4be03f738 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 reject()
rmacnak 2014/04/16 18:40:42 DBC: Should this be asserted to be unreachable for
+ {
+ 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