99 "net/http"
1010)
1111
12- // Following errors can produce HTTP status code by implementing HTTPStatusCoder interface
12+ // The following errors can produce HTTP status code by implementing HTTPStatusCoder interface
1313var (
1414 ErrBadRequest = & httpError {http .StatusBadRequest } // 400
1515 ErrUnauthorized = & httpError {http .StatusUnauthorized } // 401
2525 ErrServiceUnavailable = & httpError {http .StatusServiceUnavailable } // 503
2626)
2727
28- // Following errors fall into 500 (InternalServerError) category
28+ // The following errors fall into 500 (InternalServerError) category
2929var (
3030 ErrValidatorNotRegistered = errors .New ("validator not registered" )
3131 ErrRendererNotRegistered = errors .New ("renderer not registered" )
@@ -35,13 +35,13 @@ var (
3535 ErrInvalidListenerNetwork = errors .New ("invalid listener network" )
3636)
3737
38- // HTTPStatusCoder is interface that errors can implement to produce status code for HTTP response
38+ // HTTPStatusCoder is an interface that errors can implement to produce status code for HTTP response
3939type HTTPStatusCoder interface {
4040 StatusCode () int
4141}
4242
43- // StatusCode returns status code from error if it implements HTTPStatusCoder interface.
44- // If error does not implement the interface it returns 0.
43+ // StatusCode returns status code from err if it implements HTTPStatusCoder interface.
44+ // If err does not implement the interface, it returns 0.
4545func StatusCode (err error ) int {
4646 var sc HTTPStatusCoder
4747 if errors .As (err , & sc ) {
@@ -95,7 +95,7 @@ func ResolveResponseStatus(rw http.ResponseWriter, err error) (resp *Response, s
9595 return resp , status
9696}
9797
98- // NewHTTPError creates new instance of HTTPError
98+ // NewHTTPError creates a new instance of HTTPError
9999func NewHTTPError (code int , message string ) * HTTPError {
100100 return & HTTPError {
101101 Code : code ,
@@ -116,7 +116,7 @@ func (he *HTTPError) StatusCode() int {
116116 return he .Code
117117}
118118
119- // Error makes it compatible with ` error` interface.
119+ // Error makes it compatible with the ` error ` interface.
120120func (he * HTTPError ) Error () string {
121121 msg := he .Message
122122 if msg == "" {
@@ -128,7 +128,7 @@ func (he *HTTPError) Error() string {
128128 return fmt .Sprintf ("code=%d, message=%v, err=%v" , he .Code , msg , he .err .Error ())
129129}
130130
131- // Wrap eturns new HTTPError with given errors wrapped inside
131+ // Wrap returns a new HTTPError with given errors wrapped inside
132132func (he HTTPError ) Wrap (err error ) error {
133133 return & HTTPError {
134134 Code : he .Code ,
0 commit comments