return proper error

This commit is contained in:
kimcore
2023-01-28 23:13:36 +09:00
parent 6eb81802c3
commit 37de32ec90
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"errors"
) )
func CheckForUpdate() { func CheckForUpdate() {
@@ -25,7 +26,7 @@ func getLatestTag(repoOwner string, repoName string) (string, error) {
return "", err return "", err
} }
if resp.StatusCode != 200 { if resp.StatusCode != 200 {
return "", fmt.Sprintf("GitHub API returned status code %d", resp.StatusCode) return "", errors.New(fmt.Sprintf("GitHub API returned status code %d", resp.StatusCode))
} }
defer resp.Body.Close() defer resp.Body.Close()