all repos — homestead @ 030b21d454c51121f56b1da423c592ef4e6f3618

Code for my website

http: reduce error interface size

Alan Pearce
commit

030b21d454c51121f56b1da423c592ef4e6f3618

parent

b9efca3f3332bbb0ef0bafbafe5ac58561893507

3 files changed, 2 insertions(+), 7 deletions(-)

changed files
M domain/web/mux.godomain/web/mux.go
@@ -23,7 +23,7 @@ if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) } } else { - err.WriteHTTP(w) + http.Error(w, err.Error(), err.StatusCode()) } }
M shared/http/error.goshared/http/error.go
@@ -10,7 +10,6 @@ error
StatusCode() int Message() string Unwrap() error - WriteHTTP(w http.ResponseWriter) } type httpError struct {
@@ -41,10 +40,6 @@ }
func (e *httpError) Unwrap() error { return e.cause -} - -func (e *httpError) WriteHTTP(w http.ResponseWriter) { - http.Error(w, e.message, e.code) } func NewError(code int, message string, cause error) Error {
M shared/http/mux.goshared/http/mux.go
@@ -31,7 +31,7 @@ func NewServeMux() *ServeMux {
return &ServeMux{ ServeMux: http.NewServeMux(), errorHandler: func(err Error, w http.ResponseWriter, _ *http.Request) { - err.WriteHTTP(w) + http.Error(w, err.Error(), err.StatusCode()) }, } }