mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-07-10 00:14:38 +00:00
Handle JSON marshal error in agentic question tool response
Unchecked json.Marshal error could silently return empty string instead of surfacing the encoding failure to the caller.
This commit is contained in:
parent
ad645b2ef6
commit
e197fa3db5
1 changed files with 4 additions and 1 deletions
|
|
@ -99,7 +99,10 @@ func (a *AgenticLoop) executeQuestionTool(ctx context.Context, sessionID string,
|
|||
"question_id": questionID,
|
||||
"answers": answers,
|
||||
}
|
||||
out, _ := json.Marshal(payload)
|
||||
out, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
return fmt.Sprintf("Error: failed to encode answers: %v", err), true
|
||||
}
|
||||
return string(out), false
|
||||
case <-ticker.C:
|
||||
a.mu.Lock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue