Content-Length: 275728 | pFad | https://github.com/gitpython-developers/GitPython/issues/1924

FA Can't catch GitCommandError · Issue #1924 · gitpython-developers/GitPython · GitHub
Skip to content

Can't catch GitCommandError #1924

@zerothi

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









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/gitpython-developers/GitPython/issues/1924

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy