| 32 | } |
| 33 | |
| 34 | func (e *StatusError) Error() string { |
| 35 | underlying := e.Err.Error() |
| 36 | // Lift structured details out of the SDK error envelope (URL + status + |
| 37 | // JSON body) when possible, so the user sees what the provider actually |
| 38 | // said instead of a generic "400 Bad Request". |
| 39 | if details := parseProviderError(underlying); details != "" { |
| 40 | return fmt.Sprintf("HTTP %d: %s", e.StatusCode, details) |
| 41 | } |
| 42 | return fmt.Sprintf("HTTP %d: %s", e.StatusCode, underlying) |
| 43 | } |
| 44 | |
| 45 | func (e *StatusError) Unwrap() error { |
| 46 | return e.Err |