tsweb: don't panic if we get a tsweb.Error with no embedded error.

It's technically weird to return a tsweb.Error with no child err,
but it's a sensible thing to want to do, and we shouldn't panic
if it happens.

Signed-off-by: David Anderson <dave@natulte.net>
pull/252/head
David Anderson 4 years ago
parent 2f8719741e
commit 2c2dff9559

@ -219,7 +219,9 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
case hErrOK:
// Handler asked us to send an error. Do so, if we haven't
// already sent a response.
msg.Err = hErr.Err.Error()
if hErr.Err != nil {
msg.Err = hErr.Err.Error()
}
if lw.code != 0 {
h.logf("[unexpected] handler returned HTTPError %v, but already sent a response with code %d", hErr, lw.code)
break

Loading…
Cancel
Save