Skip to content

Commit 3fc41cf

Browse files
authored
Merge pull request #238 from setlog/fix/server_error_messages
More precise error messages in gui
2 parents 233d825 + 2b254d7 commit 3fc41cf

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* `hasher` will no longer create a directory if a non-existing one is passed as an argument.
1515
* trivrost will no longer attempt to repeat range requests to a host after it has failed to conformly respond while displaying the confusing message `Taking longer than usual: HTTP Status 200` and will now fail immediately in such cases instead.
1616
* trivrost will no longer fail to comply with HTTP 2 strictly using lower-case HTTP Header names. This had been caused by methods of `http.Header` still being oriented around HTTP 1 canonical header names due to Go's backwards compatibility promise.
17+
* Instead of always showing 'Cannot reach server' to the user, show more precise/useful messages on connection issues.
1718

1819
## 1.4.6 (2021-01-25)
1920
### Fixes

cmd/launcher/gui/gui_progress_handler.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package gui
22

33
import (
44
"fmt"
5+
"strings"
56
"sync"
67

78
"net/http"
@@ -72,7 +73,14 @@ func (handler *GuiDownloadProgressHandler) HandleHttpGetError(fromURL string, er
7273
handler.progressMutex.Lock()
7374
defer handler.progressMutex.Unlock()
7475
handler.problemUrl = fromURL
75-
NotifyProblem("Cannot reach server", false)
76+
77+
if strings.Contains(err.Error(), "x509: ") {
78+
NotifyProblem("Certificate (X.509) problem", false)
79+
} else if strings.Contains(err.Error(), "dial tcp: lookup") && strings.Contains(err.Error(), "no such host") {
80+
NotifyProblem("Unable to resolve hostname", false)
81+
} else {
82+
NotifyProblem("Connection problem", false)
83+
}
7684
}
7785

7886
func (handler *GuiDownloadProgressHandler) HandleBadHttpResponse(fromURL string, code int) {

0 commit comments

Comments
 (0)