| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """ | 5 """ |
| 6 Promise used by the python bindings. | 6 Promise used by the python bindings. |
| 7 | 7 |
| 8 The API is following the ECMAScript 6 API for promises. | 8 The API is following the ECMAScript 6 API for promises. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 try: | 187 try: |
| 188 if action: | 188 if action: |
| 189 resolve(action(x)) | 189 resolve(action(x)) |
| 190 else: | 190 else: |
| 191 resolve(x) | 191 resolve(x) |
| 192 except Exception as e: | 192 except Exception as e: |
| 193 # Adding traceback similarly to python 3.0 (pep-3134) | 193 # Adding traceback similarly to python 3.0 (pep-3134) |
| 194 e.__traceback__ = sys.exc_info()[2] | 194 e.__traceback__ = sys.exc_info()[2] |
| 195 reject(e) | 195 reject(e) |
| 196 return _Run | 196 return _Run |
| OLD | NEW |