The first patch has (at least) one unwanted side-effect: the code that raise other errors would need to be adapted (raise GitErrorSha → internal error TypeError: __init__() takes at least 2 arguments (1 given)).
Peter's patch seems to be the way to go.