-
-
Notifications
You must be signed in to change notification settings - Fork 932
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
Can't catch GitCommandError #1924
Comments
Thanks for reporting! This seems fixable and testable, and even though I don't know what's the best way to fix this, somebody coming along will. |
The problem is not with the This is instead a bug in the code you showed. That code does not catch that exception, because that exception is not what really appears in the git = repo.git Before that, except git.GitCommandError as e: Because you reassigned except repo.git.GitCommandError as e: In most cases, a bug like this would result in an (Of course, the One way to fix the bug in the code you showed would be to use a different variable name in the assignment, so that |
Ha, so true!!! How did I miss that :) Thanks! |
Might I propose that https://gitpython.readthedocs.io/en/latest/tutorial.html#using-git-directly changes |
Thanks so much for sharing, I wasn't aware! Do you think you could give that change a try? It's in |
Signed-off-by: Nick Papior <nickpapior@gmail.com>
done! |
I am trying to do a cherry-pick, but abort when it fails:
but I get this:
Now I can obviously do
except Exception as e
... But, I would like to be explicit to defer code-paths.The text was updated successfully, but these errors were encountered: