From f36433692da9dd51901057758204af131a1b822a Mon Sep 17 00:00:00 2001 From: hypervtechnics Date: Wed, 6 Apr 2022 09:52:35 +0200 Subject: [PATCH] refactor: handle parse errors to the caller in validate issue: #45 --- sv/message.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sv/message.go b/sv/message.go index 64b051b..fc7e5f7 100644 --- a/sv/message.go +++ b/sv/message.go @@ -81,7 +81,11 @@ func (p MessageProcessorImpl) SkipBranch(branch string, detached bool) bool { // Validate commit message. func (p MessageProcessorImpl) Validate(message string) error { subject, body := splitCommitMessageContent(message) - msg, _ := p.Parse(subject, body) + msg, parseErr := p.Parse(subject, body) + + if (parseErr != nil) { + return parseErr + } if !regexp.MustCompile(`^[a-z+]+(\(.+\))?!?: .+$`).MatchString(subject) { return fmt.Errorf("subject [%s] should be valid according with conventional commits", subject)