traceback is lost when using Promise.all
Closed this issue · 0 comments
lexdene commented
the following code:
from promise import Promise
def foo(v):
if v == 4:
raise ValueError(v)
return v + 1
def main():
p = Promise.all([
Promise.promisify(foo)(number)
for number in range(5)
])
p.get()
main()
I think its traceback should be like this:
Traceback (most recent call last):
File ".../venv/promise/promise.py", line 500, in _resolve_from_executor
executor(resolve, reject)
File ".../venv/promise/promise.py", line 770, in executor
return resolve(f(*args, **kwargs))
File "foo.py", line 6, in foo
raise ValueError(v)
ValueError: 4
Actually its traceback is:
Traceback (most recent call last):
File "foo.py", line 16, in <module>
main()
File "foo.py", line 14, in main
p.get()
File ".../venv/promise/promise.py", line 526, in get
return self._target_settled_value(_raise=True)
File ".../venv/promise/promise.py", line 530, in _target_settled_value
return self._target()._settled_value(_raise)
File ".../venv/promise/promise.py", line 235, in _settled_value
reraise(type(raise_val), raise_val, self._traceback)
File "<string>", line 3, in reraise
ValueError: 4
It makes me hard to debug when error happens.