1package impart 2 3import ( 4 "net/http" 5) 6 7// HTTPError holds an HTTP status code and an error message. 8type HTTPError struct { 9 Status int 10 Message string 11} 12 13// Error displays the HTTPError's error message and satisfies the error 14// interface. 15func (h HTTPError) Error() string { 16 if h.Message == "" { 17 return http.StatusText(h.Status) 18 } 19 return h.Message 20} 21