Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-raise the original exception, not a copy of it #2764

Merged
merged 1 commit into from May 14, 2017
Merged

Conversation

evgeni
Copy link
Contributor

@evgeni evgeni commented May 14, 2017

Pull Request Checklist

  • I’ve read the guidelines for contributing.
  • I updated AUTHORS.txt and CHANGES.txt (if the change is non-trivial) and documentation (if applicable).
  • I tested my changes.

Description

otherwise the resulting traceback will have the raise line as the offending one, not the really problematic one.

example:

>>> try:
...     import nothing
... except ImportError as e:
...     raise e
Traceback (most recent call last):
  File "<input>", line 5, in <module>
    raise e
ImportError: No module named nothing

>>> try:
...     import nothing
... except ImportError as e:
...     raise
Traceback (most recent call last):
  File "<input>", line 2, in <module>
    import nothing
ImportError: No module named nothing

otherwise the resulting traceback will have the `raise` line as the
offending one, not the really problematic one.

example:

    >>> try:
    ...     import nothing
    ... except ImportError as e:
    ...     raise e
    Traceback (most recent call last):
      File "<input>", line 5, in <module>
        raise e
    ImportError: No module named nothing

    >>> try:
    ...     import nothing
    ... except ImportError as e:
    ...     raise
    Traceback (most recent call last):
      File "<input>", line 2, in <module>
        import nothing
    ImportError: No module named nothing
Copy link
Member

@ralsina ralsina left a comment

Thanks for the fix!

@ralsina ralsina merged commit 119ca73 into getnikola:master May 14, 2017
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants