Skip to content

Commit

Permalink
handle NewSession() error
Browse files Browse the repository at this point in the history
  • Loading branch information
mtanda committed Jun 6, 2017
1 parent a1ddab4 commit 64cef5c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,10 @@ func (c *EC2SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
return err
}
if c.Region == "" {
sess := session.Must(session.NewSession())
sess, err := session.NewSession()
if err != nil {
return err
}
metadata := ec2metadata.New(sess)
region, err := metadata.Region()
if err != nil {
Expand Down

0 comments on commit 64cef5c

Please sign in to comment.