packer-cn/vendor/github.com/1and1/oneandone-cloudserver-sdk-go/errors.go

28 lines
437 B
Go
Raw Normal View History

2016-11-13 17:34:36 -05:00
package oneandone
import (
"fmt"
)
type errorResponse struct {
Type string `json:"type"`
Message string `json:"message"`
}
type apiError struct {
httpStatusCode int
message string
}
func (e apiError) Error() string {
return fmt.Sprintf("%d - %s", e.httpStatusCode, e.message)
}
func (e *apiError) HttpStatusCode() int {
return e.httpStatusCode
}
func (e *apiError) Message() string {
return e.message
}