From d77adbb8e5baf7de40cec34b8054c6466b1a524e Mon Sep 17 00:00:00 2001 From: zhangliang Date: Tue, 31 Mar 2026 13:51:43 +0800 Subject: [PATCH 1/3] feat(openai): enhance APIError struct with InnerError field and Unwrap method - Add InnerError field to APIError for better error context - Implement Unwrap method to facilitate error unwrapping in error handling - Update convOrigAPIError function to populate InnerError with the original error --- components/model/openai/types.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/model/openai/types.go b/components/model/openai/types.go index 1aee16675..a7fd6d531 100644 --- a/components/model/openai/types.go +++ b/components/model/openai/types.go @@ -39,6 +39,7 @@ type APIError struct { Type string `json:"type"` HTTPStatus string `json:"-"` HTTPStatusCode int `json:"-"` + InnerError error `json:"-"` } func (e *APIError) Error() string { @@ -49,6 +50,10 @@ func (e *APIError) Error() string { return e.Message } +func (e *APIError) Unwrap() error { + return e.InnerError +} + func convOrigAPIError(err error) error { apiErr := &openai2.APIError{} if errors.As(err, &apiErr) { @@ -59,6 +64,7 @@ func convOrigAPIError(err error) error { Type: apiErr.Type, HTTPStatus: apiErr.HTTPStatus, HTTPStatusCode: apiErr.HTTPStatusCode, + InnerError: err, } } return err From 48dcd9a10375d679909adf5dc6722f891bb32dca Mon Sep 17 00:00:00 2001 From: zhangliang Date: Tue, 31 Mar 2026 14:09:20 +0800 Subject: [PATCH 2/3] trigger ci From 7ad85c242f3150593805284bba424924c9632c0b Mon Sep 17 00:00:00 2001 From: zhangliang Date: Tue, 31 Mar 2026 14:10:21 +0800 Subject: [PATCH 3/3] trigger ci