Skip to content

Commit

Permalink
fix: check error on error write to response
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Oct 3, 2023
1 parent 7d47ca4 commit 6fd934a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion httpipfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ func (hi *HttpIpfs) ServeHTTP(res http.ResponseWriter, req *http.Request) {
return
default:
res.WriteHeader(status)
res.Write([]byte(err.Error()))
_, werr := res.Write([]byte(err.Error()))
if werr != nil {
logger.Debugw("unable to write error to response", "err", werr)
}
}

if lrw, ok := res.(ErrorLogger); ok {
Expand Down

0 comments on commit 6fd934a

Please sign in to comment.