[volume] requests that were canceled by the client are not an internal server problem(500 => 499) (#5304)

This commit is contained in:
Konstantin Lebedev
2024-02-15 03:18:56 +05:00
committed by GitHub
parent 3d463ef471
commit 8fb978d6f6
3 changed files with 4 additions and 2 deletions

View File

@@ -50,7 +50,7 @@ func (fs *FilerServer) autoChunk(ctx context.Context, w http.ResponseWriter, r *
}
if err != nil {
if strings.HasPrefix(err.Error(), "read input:") || err.Error() == io.ErrUnexpectedEOF.Error() {
writeJsonError(w, r, 499, err)
writeJsonError(w, r, util.HttpStatusCancelled, err)
} else if strings.HasSuffix(err.Error(), "is a file") || strings.HasSuffix(err.Error(), "already exists") {
writeJsonError(w, r, http.StatusConflict, err)
} else {