1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-12-02 20:22:52 +00:00

improve some error messages

This commit is contained in:
Laura
2025-11-01 23:19:27 +01:00
parent 9fa1c29365
commit 9b33b92d8e
2 changed files with 4 additions and 4 deletions

View File

@@ -404,7 +404,7 @@ func HandleChat(w http.ResponseWriter, r *http.Request) {
func RunCompletion(ctx context.Context, response *Stream, request *openrouter.ChatCompletionRequest) (*ToolCall, string, error) { func RunCompletion(ctx context.Context, response *Stream, request *openrouter.ChatCompletionRequest) (*ToolCall, string, error) {
stream, err := OpenRouterStartStream(ctx, *request) stream, err := OpenRouterStartStream(ctx, *request)
if err != nil { if err != nil {
return nil, "", err return nil, "", fmt.Errorf("stream.start: %v", err)
} }
defer stream.Close() defer stream.Close()
@@ -426,7 +426,7 @@ func RunCompletion(ctx context.Context, response *Stream, request *openrouter.Ch
break break
} }
return nil, "", err return nil, "", fmt.Errorf("stream.receive: %v", err)
} }
if id == "" { if id == "" {

View File

@@ -207,7 +207,7 @@ func HandleGitHubRepositoryTool(ctx context.Context, tool *ToolCall) error {
func ParseAndUpdateArgs(tool *ToolCall, arguments any) error { func ParseAndUpdateArgs(tool *ToolCall, arguments any) error {
err := json.Unmarshal([]byte(tool.Args), arguments) err := json.Unmarshal([]byte(tool.Args), arguments)
if err != nil { if err != nil {
return err return fmt.Errorf("json.unmarshal: %v", err)
} }
buf := GetFreeBuffer() buf := GetFreeBuffer()
@@ -218,7 +218,7 @@ func ParseAndUpdateArgs(tool *ToolCall, arguments any) error {
err = enc.Encode(arguments) err = enc.Encode(arguments)
if err != nil { if err != nil {
return err return fmt.Errorf("json.marshal: %v", err)
} }
tool.Args = buf.String() tool.Args = buf.String()