Skip to content

Commit e5cef8e

Browse files
add better error handler
1 parent 672c9ec commit e5cef8e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/codefresh/gitops.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package codefresh
22

33
import (
4+
"errors"
45
"fmt"
56
"time"
67
)
@@ -151,6 +152,10 @@ func (a *gitops) CreateEnvironment(name string, project string, application stri
151152
},
152153
},
153154
})
155+
if resp != nil && resp.StatusCode >= 400 {
156+
return errors.New(fmt.Sprintf("Failed to create environment, reason %v", resp.Status))
157+
}
158+
154159
if err != nil {
155160
return err
156161
}

0 commit comments

Comments
 (0)