Skip to content

Can't catch GitCommandError #1924

Description

@zerothi

I am trying to do a cherry-pick, but abort when it fails:

import git
...
git = repo.git
try:
    git.cherry_pick(commit)
except git.GitCommandError as e:
    git.cherry_pick(abort=True)
...

but I get this:

    except git.GitCommandError as e:
   TypeError: catching classes that do not inherit from BaseException is not allowed

Now I can obviously do except Exception as e... But, I would like to be explicit to defer code-paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions