From 351a78b1eb722b65303dfc4084e8c4799a1709d7 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 19 Dec 2019 11:28:08 +0900 Subject: [PATCH] improve error message when regex for filter is broken --- selfupdate/updater.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/selfupdate/updater.go b/selfupdate/updater.go index 9eba202..2acaebf 100644 --- a/selfupdate/updater.go +++ b/selfupdate/updater.go @@ -2,6 +2,7 @@ package selfupdate import ( "context" + "fmt" "net/http" "os" "regexp" @@ -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) }