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

Unified Diff: mojo/public/python/mojo/bindings/promise.py

Issue 695583002: Update mojo sdk to rev e083961bf11fd0c94d40be8853761da529b6d444 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch in https://codereview.chromium.org/692823003 Created 6 years, 2 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 | « mojo/public/python/mojo/bindings/messaging.py ('k') | mojo/public/python/mojo/bindings/reflection.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/python/mojo/bindings/promise.py
diff --git a/mojo/public/python/mojo/bindings/promise.py b/mojo/public/python/mojo/bindings/promise.py
index c5d7d7cb641945e14af53d1b1d5e681db57d21b2..ebf6f85e0dcc034f3346a8a2197170012831bb2b 100644
--- a/mojo/public/python/mojo/bindings/promise.py
+++ b/mojo/public/python/mojo/bindings/promise.py
@@ -8,6 +8,8 @@ Promise used by the python bindings.
The API is following the ECMAScript 6 API for promises.
"""
+import sys
+
class Promise(object):
"""The promise object."""
@@ -33,8 +35,12 @@ class Promise(object):
self._onRejected = []
self._state = Promise.STATE_PENDING
self._result = None
- if generator_function:
+ try:
generator_function(self._Resolve, self._Reject)
+ except Exception as e:
+ # Adding traceback similarly to python 3.0 (pep-3134)
+ e.__traceback__ = sys.exc_info()[2]
+ self._Reject(e)
@staticmethod
def Resolve(value):
@@ -184,5 +190,7 @@ def _Delegate(resolve, reject, action):
else:
resolve(x)
except Exception as e:
+ # Adding traceback similarly to python 3.0 (pep-3134)
+ e.__traceback__ = sys.exc_info()[2]
reject(e)
return _Run
« no previous file with comments | « mojo/public/python/mojo/bindings/messaging.py ('k') | mojo/public/python/mojo/bindings/reflection.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698