Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ type Run struct {
func (r *Run) Text() (string, error) {
r.lock.Lock()
defer r.lock.Unlock()
if r.err != nil {
return "", fmt.Errorf("run encounterd an error: %w with error output: %s", r.err, r.errput)
}

return r.output, nil
return r.output, r.Err()
}

// Bytes returns the output of the gptscript in bytes. It blocks until the output is ready.
Expand All @@ -62,7 +59,10 @@ func (r *Run) State() RunState {

// Err returns the error that caused the gptscript to fail, if any.
func (r *Run) Err() error {
return r.err
if r.err != nil {
return fmt.Errorf("run encounterd an error: %w with error output: %s", r.err, r.errput)
}
return nil
}

// Program returns the gptscript program for the run.
Expand Down