mirror of https://github.com/docker/docs.git
22 lines
366 B
Go
22 lines
366 B
Go
package errors
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// HTTPError represents an application error which will map to
|
|
// an HTTP status code and returned error object.
|
|
type HTTPError struct {
|
|
HTTPStatus int
|
|
Code int
|
|
Err error
|
|
}
|
|
|
|
func (he *HTTPError) Error() string {
|
|
msg := ""
|
|
if he.Err != nil {
|
|
msg = he.Err.Error()
|
|
}
|
|
return fmt.Sprintf("%d: %s", he.Code, msg)
|
|
}
|