Tesla/api/error.go
Matthieu 'JP' DERASSE 444d9b1563
All checks were successful
continuous-integration/drone/push Build is passing
feat(init): Start a bot for tesla
2023-06-05 13:59:39 +00:00

19 lines
387 B
Go

package api
import "fmt"
// Error represent an API Error.
type Error struct {
HTTPCode int `json:"-"`
HTTPMessage string `json:"-"`
}
// Error statisfy the standard Error interface and return a human readeable message.
func (a Error) Error() string {
return fmt.Sprintf(
"API call failed with the following error: %s (HTTP status: %d)",
a.HTTPMessage,
a.HTTPCode,
)
}