Skip to content

Commit

Permalink
improved provider error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
martensson committed Aug 22, 2019
1 parent 2912148 commit d794ef9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ func Provider() *schema.Provider {
}

func providerConfigure(d *schema.ResourceData) (interface{}, error) {
if d.Get("username").(string) != "" && d.Get("password").(string) == "" {
return nil, errors.New("lastpass password is not set")
if d.Get("username").(string) == "" {
return nil, errors.New("provider username can not be empty string")
} else if d.Get("password").(string) == "" {
return nil, errors.New("provider password can not be empty string")
}
client := lastpass.Client{
Username: d.Get("username").(string),
Expand Down

0 comments on commit d794ef9

Please sign in to comment.