Status error should default to internal server error. Otherwise it will trigger a nil pointer and subsequent panic.

This commit is contained in:
Mark Beamer Jr 2021-04-21 13:58:38 -04:00
parent 2b155597bf
commit a1177c17d3
No known key found for this signature in database
GPG key ID: 1C314FB89AD76973

View file

@ -121,6 +121,9 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if rsp.Error != nil {
ogErr := errors.Unwrap(rsp.Error)
if statusError, ok := ogErr.(StatusError); ok {
if statusError.Status == 0 {
statusError.Status = http.StatusInternalServerError
}
rsp.Status = statusError.Status
} else {
rsp.Status = http.StatusInternalServerError