diff --git a/pkg/infinity/http_error.go b/pkg/infinity/http_error.go index ff4caa43..fcf08275 100644 --- a/pkg/infinity/http_error.go +++ b/pkg/infinity/http_error.go @@ -14,7 +14,6 @@ import ( type HTTPResponseError struct { StatusCode int // HTTP status code Message string // Extracted error message from the HTTP response if any - TraceID string // Extracted trace ID from the HTTP response if any } // Error implements the error interface for HTTPResponseError. @@ -26,9 +25,6 @@ func (h *HTTPResponseError) Error() string { if h.Message != "" { err = errors.Join(err, fmt.Errorf("Error message from HTTP response: %s", h.Message)) } - if h.TraceID != "" { - err = errors.Join(err, fmt.Errorf("TraceID from HTTP response: %s", h.TraceID)) - } return err.Error() } @@ -65,11 +61,6 @@ func ParseErrorResponse(res *http.Response) error { if unmarshalErr != nil { return err } - for _, key := range []string{"trace_id", "traceId", "traceID"} { - if traceId, ok := out[key].(string); ok && traceId != "" { - err.TraceID = traceId - } - } for _, key := range []string{"error", "message", "status"} { if errMsg, ok := out[key].(string); ok && errMsg != "" { err.Message = errMsg diff --git a/pkg/infinity/http_error_test.go b/pkg/infinity/http_error_test.go index 8f3dadd3..53184483 100644 --- a/pkg/infinity/http_error_test.go +++ b/pkg/infinity/http_error_test.go @@ -71,22 +71,6 @@ func TestParseErrorResponse(t *testing.T) { }, wantErr: "unsuccessful HTTP response\nHTTP status code: 500 Internal Server Error\nError message from HTTP response: foo", }, - { - name: "Internal server error with JSON traceId", - res: &http.Response{ - StatusCode: http.StatusInternalServerError, - Body: io.NopCloser(strings.NewReader(`{ "traceId" : "bar" }`)), - }, - wantErr: "unsuccessful HTTP response\nHTTP status code: 500 Internal Server Error\nTraceID from HTTP response: bar", - }, - { - name: "Internal server error with JSON message and traceId", - res: &http.Response{ - StatusCode: http.StatusInternalServerError, - Body: io.NopCloser(strings.NewReader(`{ "error" : "foo", "traceId" : "bar" }`)), - }, - wantErr: "unsuccessful HTTP response\nHTTP status code: 500 Internal Server Error\nError message from HTTP response: foo\nTraceID from HTTP response: bar", - }, { name: "Invalid JSON content response", res: &http.Response{