File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,11 @@ func main() {
5858 os .Exit (10 )
5959 }
6060
61- awsClient := createAWSClient (cfg .Region )
61+ awsClient , err := createAWSClient (cfg .Region )
62+ if err != nil {
63+ log .Printf ("Couldn't create AWS client: %v" , err )
64+ os .Exit (10 )
65+ }
6266
6367 for _ , ups := range cfg .Upstreams {
6468 if ups .Kind == "http" {
@@ -142,16 +146,16 @@ func main() {
142146 }
143147}
144148
145- func createAWSClient (region string ) * AWSClient {
149+ func createAWSClient (region string ) ( * AWSClient , error ) {
146150 httpClient := & http.Client {Timeout : connTimeoutInSecs * time .Second }
147151 cfg := & aws.Config {Region : aws .String (region ), HTTPClient : httpClient }
148- session , err := session .NewSession (cfg )
149152
153+ session , err := session .NewSession (cfg )
150154 if err != nil {
151- log . Printf ( "Error while creating AWS Client: %v" , err )
155+ return nil , err
152156 }
153157
154158 svcAutoscaling := autoscaling .New (session )
155159 svcEC2 := ec2 .New (session )
156- return NewAWSClient (svcEC2 , svcAutoscaling )
160+ return NewAWSClient (svcEC2 , svcAutoscaling ), nil
157161}
You can’t perform that action at this time.
0 commit comments