cpliakas / git-wrapper

A PHP wrapper around the Git command line utility.
MIT License
505 stars 68 forks source link

Add exit code to GitException #222

Closed simonschaufi closed 3 years ago

simonschaufi commented 3 years ago

In case you want to know the exit code of the process for further error handling, it is now passed as error code

GrahamCampbell commented 3 years ago

I don't think the exception code should be abused in this way. Maybe you should instead add a private property and a public getter for the exit code, and maybe add a public static create method to the exception (because changing the constructor is breaking).

simonschaufi commented 3 years ago

The funny thing is that the error code is actually passed on but always 0 because it's never set. Since the output is returned as string and an exception is thrown, a property doesn't make much sense as the exception is the only thing I get if exit code is not 0.

You are free to clone my repo and come up with a better solution by pushing into the branch

GrahamCampbell commented 3 years ago

But the exception code is nothing to do with an error code?

simonschaufi commented 3 years ago

I just saw that the package is abandoned, so no further development here needed...

TomasVotruba commented 3 years ago

See https://github.com/cpliakas/git-wrapper/issues/225

The work continues in https://github.com/symplify/symplify