Status error should default to internal server error. Otherwise it will trigger a nil pointer and subsequent panic.
This commit is contained in:
parent
2b155597bf
commit
a1177c17d3
1 changed files with 3 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue