disco/ws: handle http 404 error

helps with issues of type #25
This commit is contained in:
rkonfj
2025-01-05 18:51:59 +08:00
parent 4b11ef294b
commit 0e9b0a34b8

View File

@@ -218,6 +218,9 @@ func (c *WSConn) dial(ctx context.Context, server string) error {
if httpResp != nil && httpResp.StatusCode == http.StatusBadRequest {
return fmt.Errorf("address: %s is already in used", c.peerID)
}
if httpResp != nil && httpResp.StatusCode == http.StatusNotFound {
return fmt.Errorf("dial server %s: 404 not found", server)
}
if httpResp != nil && httpResp.StatusCode == http.StatusForbidden {
var err disco.Error
json.NewDecoder(httpResp.Body).Decode(&err)