@@ -17,14 +17,24 @@ import (
1717
1818// APIError represents an api error response.
1919type 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"`
2325 Message string `json:"message"` // Summary of the error
2426 Details []string `json:"details,omitempty"` // Detailed error messages, if any
2527 RawResponse string `json:"raw_response"` // Raw response body for debugging
2628}
2729
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+
2838// Error returns a string representation of the APIError, making it compatible with the error interface.
2939func (e * APIError ) Error () string {
3040 data , err := json .Marshal (e )
0 commit comments