File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 1- 0.1.0
1+ 0.1.1
Original file line number Diff line number Diff line change 1515package cmd
1616
1717import (
18+ "fmt"
19+
1820 "github.com/codefresh-io/go-sdk/internal"
1921 "github.com/codefresh-io/go-sdk/pkg/codefresh"
2022 humanize "github.com/dustin/go-humanize"
@@ -32,7 +34,7 @@ var getPipelineCmd = &cobra.Command{
3234 client := viper .Get ("codefresh" )
3335 codefreshClient , ok := client .(codefresh.Codefresh )
3436 if ! ok {
35- panic ( "Faild to create Codefresh cleint" )
37+ internal . DieOnError ( fmt . Errorf ( "Faild to create Codefresh client" ) )
3638 }
3739 table := internal .CreateTable ()
3840 table .SetHeader ([]string {"Pipeline Name" , "Created At" , "Updated At" })
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ package codefresh
22
33import (
44 "fmt"
5+ "net/url"
6+
7+ "github.com/codefresh-io/go-sdk/internal"
58
69 "gopkg.in/h2non/gentleman.v2"
710 "gopkg.in/h2non/gentleman.v2/plugins/body"
@@ -28,7 +31,9 @@ func New(opt *ClietOptions) Codefresh {
2831
2932func (c * codefresh ) requestAPI (opt * requestOptions ) (* gentleman.Response , error ) {
3033 req := c .client .Request ()
31- req .Path (opt .path )
34+ url , err := url .Parse (opt .path )
35+ internal .DieOnError (err )
36+ req .Path (url .String ())
3237 req .Method (opt .method )
3338 req .AddHeader ("Authorization" , c .token )
3439 if opt .body != nil {
Original file line number Diff line number Diff line change 11package utils
22
33import (
4+ "fmt"
5+
6+ "github.com/codefresh-io/go-sdk/internal"
47 "github.com/codefresh-io/go-sdk/pkg/codefresh"
58)
69
710func CastToCodefreshOrDie (candidate interface {}) codefresh.Codefresh {
811 client , ok := candidate .(codefresh.Codefresh )
912 if ! ok {
10- panic ( "Failed to cast candidate to Codefresh client" )
13+ internal . DieOnError ( fmt . Errorf ( "Failed to cast candidate to Codefresh client" ) )
1114 }
1215 return client
1316}
You can’t perform that action at this time.
0 commit comments