git-php icon indicating copy to clipboard operation
git-php copied to clipboard

Hability to output `verbose` message in `GitException`

Open PululuK opened this issue 2 years ago • 5 comments

PululuK avatar Feb 01 '22 16:02 PululuK

Hello, thanks for PR. Why you need this change? You can just use:

try {
    // $git->open()
    // $gitRepository->xyz()

} catch (CzProject\GitPhp\GitException $e) {
    $e->getRunnerResult()->toText();
}

janpecha avatar Feb 01 '22 17:02 janpecha

Hello @janpecha

Exactly the ideia is to avoid to call runner, and access directly toText message int default Exception::getMessage if verbose mode is enabled of course.

PululuK avatar Feb 01 '22 17:02 PululuK

It seems useless for me. If I can call Exception::getMessage() I can call $e->getRunnerResult()->toText() too.

What about to add new method GitException::getVerboseMessage() - then you can call $e->getVerboseMessage()?

janpecha avatar Feb 01 '22 17:02 janpecha

It seems useless for me. If I can call Exception::getMessage() I can call $e->getRunnerResult()->toText() too.

What about to add new method GitException::getVerboseMessage() - then you can call $e->getVerboseMessage()?

You are right @janpecha ! Thanks

PululuK avatar Feb 01 '22 18:02 PululuK

Nice! Can you fix static analysis & code style errors please? And change commit message to something like GitException: added method getVerboseMessage().

janpecha avatar Feb 02 '22 08:02 janpecha