Skip to content

Commit 9218f84

Browse files
committed
refactor: improve error handling and increase test coverage
- Add the `fmt` package import - Improve error message when failing to create a new HTTP client Signed-off-by: appleboy <[email protected]>
1 parent 92f34cf commit 9218f84

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

provider/openai/openai.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package openai
22

33
import (
44
"context"
5+
"fmt"
56
"regexp"
67

78
"github.com/appleboy/CodeGPT/core"
@@ -225,7 +226,7 @@ func New(opts ...Option) (*Client, error) {
225226
proxy.WithHeaders(cfg.headers),
226227
)
227228
if err != nil {
228-
return nil, err
229+
return nil, fmt.Errorf("can't create a new HTTP client: %w", err)
229230
}
230231

231232
// Set the OpenAI client to use the default configuration with Azure-specific options, if the provider is Azure.

0 commit comments

Comments
 (0)