We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 857b9de + 11cb30d commit 4d78314Copy full SHA for 4d78314
run.go
@@ -42,11 +42,8 @@ type Run struct {
42
func (r *Run) Text() (string, error) {
43
r.lock.Lock()
44
defer r.lock.Unlock()
45
- if r.err != nil {
46
- return "", fmt.Errorf("run encounterd an error: %w with error output: %s", r.err, r.errput)
47
- }
48
49
- return r.output, nil
+ return r.output, r.Err()
50
}
51
52
// Bytes returns the output of the gptscript in bytes. It blocks until the output is ready.
@@ -62,7 +59,10 @@ func (r *Run) State() RunState {
62
59
63
60
// Err returns the error that caused the gptscript to fail, if any.
64
61
func (r *Run) Err() error {
65
- 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
66
67
68
// Program returns the gptscript program for the run.
0 commit comments