providers/atlas: make errors more readable

This commit is contained in:
Mitchell Hashimoto 2014-12-09 16:53:38 -08:00
parent 4e503d1d64
commit 124d9fc0bd
1 changed files with 6 additions and 3 deletions

View File

@ -129,13 +129,16 @@ func resourceArtifactRead(d *schema.ResourceData, meta interface{}) error {
}) })
if err != nil { if err != nil {
return fmt.Errorf( return fmt.Errorf(
"Error searching for artifact: %s", err) "Error searching for artifact '%s/%s': %s",
user, name, err)
} }
if len(vs) == 0 { if len(vs) == 0 {
return fmt.Errorf("No matching artifact") return fmt.Errorf("No matching artifact for '%s/%s'", user, name)
} else if len(vs) > 1 { } else if len(vs) > 1 {
return fmt.Errorf("Got %d results, only one is allowed", len(vs)) return fmt.Errorf(
"Got %d results for '%s/%s', only one is allowed",
user, name, len(vs))
} }
v := vs[0] v := vs[0]