From 0e9b0a34b8b232f86afae38a12c2c209f35c423f Mon Sep 17 00:00:00 2001 From: rkonfj Date: Sun, 5 Jan 2025 18:51:59 +0800 Subject: [PATCH] disco/ws: handle http 404 error helps with issues of type #25 --- disco/ws/ws.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/disco/ws/ws.go b/disco/ws/ws.go index b1d72d7..89de71e 100644 --- a/disco/ws/ws.go +++ b/disco/ws/ws.go @@ -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)