Skip to content

Fix timeout error check #505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions pkg/version/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ var (
ErrNoAssets = errors.New("no assets")
ErrChecksumMismatch = errors.New("checksum mismatch")
ErrUnsupportedChecksumFormat = errors.New("unsupported checksum format")
ErrTimeoutExceeded = errors.New("timeout exceeded")
)

type githubAsset struct {
Expand Down Expand Up @@ -97,10 +96,7 @@ func downloadAndParseChecksum(timeout time.Duration, url string, assetName strin
}
resp, err := httpClient.Get(url)
if err != nil {
if os.IsTimeout(err) {
return "", ErrTimeoutExceeded
}
return "", err
return "", errors.Wrap(err, "http get")
}
defer resp.Body.Close()

Expand Down Expand Up @@ -223,9 +219,6 @@ func downloadFile(url string, timeout time.Duration) (string, string, error) {
}
resp, err := httpClient.Get(url)
if err != nil {
if os.IsTimeout(err) {
return "", "", ErrTimeoutExceeded
}
return "", "", errors.Wrap(err, "get file")
}
defer resp.Body.Close()
Expand Down Expand Up @@ -356,9 +349,6 @@ func getReleaseDetails(timeout time.Duration, host string, owner string, repo st
}
resp, err := httpClient.Do(req)
if err != nil {
if os.IsTimeout(err) {
return nil, ErrTimeoutExceeded
}
return nil, errors.Wrap(err, "do request")
}
defer resp.Body.Close()
Expand Down
2 changes: 1 addition & 1 deletion pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func initBuild() {
if os.Getenv("CI") != "true" {
build.UpdateInfo, err = updateChecker.GetUpdateInfo()
if err != nil {
if errors.Cause(err) == ErrTimeoutExceeded {
if os.IsTimeout(errors.Cause(err)) {
// i'm going to leave this println out for now because it could be really noisy
// for someone with a slow connection
// fmt.Fprintln(os.Stderr, "Unable to check for updates, timeout exceeded.")
Expand Down