| 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
|
|
|