diff --git a/src/PhpGitHooks/Module/Git/Service/CommitMsgTool.php b/src/PhpGitHooks/Module/Git/Service/CommitMsgTool.php index 5b6a50c..7384abf 100644 --- a/src/PhpGitHooks/Module/Git/Service/CommitMsgTool.php +++ b/src/PhpGitHooks/Module/Git/Service/CommitMsgTool.php @@ -55,13 +55,16 @@ public function run(InputInterface $input) if (true === $configurationDataResponse->getCommitMsg()->isCommitMsg()) { $commitContent = $this->commitMessageFinder->find($input->getFirstArgument()); - $validMessage = $this->isValidCommitMessage( - $configurationDataResponse->getCommitMsg()->getRegularExpression(), - $commitContent - ); + $regularExpression = $configurationDataResponse->getCommitMsg()->getRegularExpression(); + $validMessage = $this->isValidCommitMessage($regularExpression, $commitContent); if (false === $validMessage) { - throw new InvalidCommitMessageException(); + throw new InvalidCommitMessageException( + sprintf( + 'Invalid Commit message: commit message does not match regex %s !', + $regularExpression + ) + ); } } }