You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/09/14 00:51:47 UTC

[GitHub] [beam] ibzib edited a comment on pull request #15417: [BEAM-12794] raise proper error from exc_info

ibzib edited a comment on pull request #15417:
URL: https://github.com/apache/beam/pull/15417#issuecomment-918702203


   Hi @lazylynx I don't think we should need to implement custom exception handling like this. I researched this issue and found https://www.python.org/dev/peps/pep-3134. The summary is that re-raising exceptions caused the original traceback to be lost in Python 2, but it was fixed in Python 3. So we needed `sys.exc_info()` in Python 2, but I think we can remove `sys.exc_info()` now and simply store and re-raise exceptions without worrying about losing the traceback. You can see the difference for yourself by running this script with Python 2 and then Python 3.
   
   ```
   try:
       raise ValueError('oops')
   except ValueError as e:
       exc = e
   
   raise exc
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org