Skip to content

Commit

Permalink
Log instead of panic on response writing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamSLevy committed Oct 11, 2019
1 parent 7b72ef8 commit f5019a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ func HTTPRequestHandler(methods MethodMap) http.HandlerFunc {
// MethodFunc.call() already Marshaled any user provided Data
// or Result, and everything else is marshalable.
//
// However an error can be returned related to w.Write. At this
// point we just rely on the http.Server to recover us.
// However an error can be returned related to w.Write, which
// there is nothing we can do about, so we just log it here.
if err := enc.Encode(res); err != nil {
panic(err)
logger.Println("error writing response: %v", err)
}
}
}
Expand Down

0 comments on commit f5019a6

Please sign in to comment.