diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-19 03:04:43 -0400 |
---|---|---|
committer | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-19 03:04:43 -0400 |
commit | 1df6f9a765a9f4371757545be963c1fcb2bafa95 (patch) | |
tree | db4b62f25b1277fa04a5881902fe250d3a856328 | |
parent | 36bc4748543380a55b3d1c9de08cfd867f5707df (diff) | |
download | Atlas-1df6f9a765a9f4371757545be963c1fcb2bafa95.tar.gz Atlas-1df6f9a765a9f4371757545be963c1fcb2bafa95.zip |
pkg/api/api0: Use different error code for a2s timeout when verifying server
-rw-r--r-- | pkg/api/api0/server.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/api/api0/server.go b/pkg/api/api0/server.go index 68c94c9..9834c1b 100644 --- a/pkg/api/api0/server.go +++ b/pkg/api/api0/server.go @@ -316,7 +316,14 @@ func (h *Handler) handleServerUpsert(w http.ResponseWriter, r *http.Request) { } if err := a2s.Probe(s.Addr, time.Until(nsrv.VerificationDeadline)); err != nil { - respFail(w, r, http.StatusBadGateway, ErrorCode_BAD_GAMESERVER_RESPONSE.MessageObjf("failed to connect to game port: %v", err)) + var code ErrorCode + switch { + case errors.Is(err, a2s.ErrTimeout): + code = ErrorCode_NO_GAMESERVER_RESPONSE + default: + code = ErrorCode_BAD_GAMESERVER_RESPONSE + } + respFail(w, r, http.StatusBadGateway, code.MessageObjf("failed to connect to game port: %v", err)) return } |