Skip to content

Commit

Permalink
improve error message when regex for filter is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Dec 19, 2019
1 parent 53849d1 commit 351a78b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions selfupdate/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package selfupdate

import (
"context"
"fmt"
"net/http"
"os"
"regexp"
Expand Down Expand Up @@ -61,9 +62,9 @@ func NewUpdater(config Config) (*Updater, error) {

filtersRe := make([]*regexp.Regexp, 0, len(config.Filters))
for _, filter := range config.Filters {
re, erx := regexp.Compile(filter)
if erx != nil {
return nil, erx
re, err := regexp.Compile(filter)
if err != nil {
return nil, fmt.Errorf("Could not compile regular expression %q for filtering releases: %v", filter, err)
}
filtersRe = append(filtersRe, re)
}
Expand Down

0 comments on commit 351a78b

Please sign in to comment.