mirror of
https://github.com/bestbytes/datatrans.git
synced 2025-10-16 12:05:36 +00:00
27 lines
494 B
Go
27 lines
494 B
Go
package datatrans
|
|
|
|
import "fmt"
|
|
|
|
type ErrorResponse struct {
|
|
HTTPStatusCode int
|
|
ErrorDetail ErrorDetail `json:"error"`
|
|
}
|
|
|
|
// see https://docs.datatrans.ch/docs/error-messages
|
|
type ErrorDetail struct {
|
|
Code string `json:"code"`
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
func (s ErrorResponse) Error() string {
|
|
if s.ErrorDetail.Code == "" {
|
|
return ""
|
|
}
|
|
return fmt.Sprintf(
|
|
"HTTPStatusCode:%d Code:%q, Message:%q",
|
|
s.HTTPStatusCode,
|
|
s.ErrorDetail.Code,
|
|
s.ErrorDetail.Message,
|
|
)
|
|
}
|