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

Raise from previous error should not be triggered when the raised error is the caught error. #202

Closed
Luttik opened this issue Mar 7, 2022 · 3 comments
Assignees
Labels
bug Something isn't working next release This will be fixed in next release

Comments

@Luttik
Copy link

Luttik commented Mar 7, 2022

Issue description or question

Currently a codeblock like the one below will give the raise-from-previous-error advice even though it clearly should not happen:

except HttpError as e:
    if "already exists" not in e.reason:
        raise e

My advice is to check if the raised exception is the caught exception and if so not trigger the raise-from-previous-error rule.

Sourcery Version

Pycharm plugin 0.10.3

@ruancomelli ruancomelli added the bug Something isn't working label Mar 7, 2022
@ruancomelli ruancomelli self-assigned this Mar 7, 2022
@ruancomelli
Copy link
Contributor

Hi, @Luttik, thank you for opening this issue. You're totally right, it doesn't make much sense for this suggestion to trigger in this case. I was able to reproduce this and will work on a fix as soon as possible.

@ruancomelli ruancomelli added the next release This will be fixed in next release label Mar 8, 2022
@ruancomelli
Copy link
Contributor

This bug was fixed and will be available in the next release. Thank you again for raising this!

@ruancomelli ruancomelli reopened this Mar 8, 2022
@Hellebore
Copy link
Collaborator

Fixed with release of 0.11.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next release This will be fixed in next release
Projects
None yet
Development

No branches or pull requests

3 participants