@@ -17,14 +17,24 @@ import (
17
17
18
18
// APIError represents an api error response.
19
19
type APIError struct {
20
- StatusCode int `json:"status_code"` // HTTP status code
21
- Method string `json:"method"` // HTTP method used for the request
22
- URL string `json:"url"` // The URL of the HTTP request
20
+ StatusCode int `json:"status_code"` // HTTP status code
21
+ Method string `json:"method"` // HTTP method used for the request
22
+ URL string `json:"url"` // The URL of the HTTP request
23
+ HTTPStatus int `json:"httpStatus,omitempty"`
24
+ Errors []Errors `json:"errors,omitempty"`
23
25
Message string `json:"message"` // Summary of the error
24
26
Details []string `json:"details,omitempty"` // Detailed error messages, if any
25
27
RawResponse string `json:"raw_response"` // Raw response body for debugging
26
28
}
27
29
30
+ // Errors represents individual error details within an API error response.
31
+ type Errors struct {
32
+ Code string `json:"code,omitempty"`
33
+ Field string `json:"field,omitempty"`
34
+ Description string `json:"description,omitempty"`
35
+ ID * string `json:"id,omitempty"`
36
+ }
37
+
28
38
// Error returns a string representation of the APIError, making it compatible with the error interface.
29
39
func (e * APIError ) Error () string {
30
40
data , err := json .Marshal (e )
0 commit comments