Handling context canceled errors in avatar.

This commit is contained in:
Nick Gerakines 2020-04-19 10:49:41 -04:00
parent f5d6c24c72
commit 28a3df182c
No known key found for this signature in database
GPG Key ID: 33D43D854F96B2E4
1 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package web
import (
"bytes"
"context"
"fmt"
"net/http"
@ -34,6 +35,10 @@ func (h handler) avatarPNG(c *gin.Context) {
readerCloser, length, err := h.svgConverter.Convert(c.Request.Context(), svg)
if err != nil {
if err == context.Canceled {
c.Status(http.StatusOK)
return
}
h.hardFail(c, err)
return
}