0
0
mirror of https://github.com/thegeeklab/git-sv.git synced 2024-11-21 22:10:39 +00:00

revert: "refactor: add error handling for parsing messages"

This reverts commit c6aaac5638.
issue: #45
This commit is contained in:
hypervtechnics 2022-04-04 09:23:53 +02:00
parent c6aaac5638
commit 25458f20f6
2 changed files with 2 additions and 2 deletions

View File

@ -256,7 +256,7 @@ func (p MessageProcessorImpl) prepareHeader(header string) (string, error) {
match := regex.FindStringSubmatch(header)
if match == nil || len(match) < index {
return header, nil
return "", fmt.Errorf("could not find %s regex group in match result for '%s'", messageRegexGroupName, header)
}
return match[index], nil

View File

@ -534,7 +534,7 @@ func Test_prepareHeader(t *testing.T) {
{"matching conventional with selector with group", "Merged PR (\\d+): (?P<header>.*)", "Merged PR 123: feat: something", "feat: something", false},
{"matching non-conventional with selector with group", "Merged PR (\\d+): (?P<header>.*)", "Merged PR 123: something", "something", false},
{"matching non-conventional with selector without group", "Merged PR (\\d+): (.*)", "Merged PR 123: something", "", true},
{"non-matching non-conventional with selector with group", "Merged PR (\\d+): (?P<header>.*)", "something", "something", false},
{"non-matching non-conventional with selector with group", "Merged PR (\\d+): (?P<header>.*)", "something", "", true},
{"matching non-conventional with invalid regex", "Merged PR (\\d+): (?<header>.*)", "Merged PR 123: something", "", true},
}
for _, tt := range tests {