orchestration v1 error types
diff --git a/openstack/orchestration/v1/stacks/requests.go b/openstack/orchestration/v1/stacks/requests.go
index 2566bb2..650763c 100644
--- a/openstack/orchestration/v1/stacks/requests.go
+++ b/openstack/orchestration/v1/stacks/requests.go
@@ -1,7 +1,6 @@
package stacks
import (
- "errors"
"strings"
"github.com/gophercloud/gophercloud"
@@ -83,7 +82,9 @@
s := make(map[string]interface{})
if opts.Name == "" {
- return s, errors.New("Required field 'Name' not provided.")
+ err := gophercloud.ErrMissingInput{}
+ err.Argument = "stacks.CreateOpts.Name"
+ return nil, err
}
s["stack_name"] = opts.Name
Files := make(map[string]string)
@@ -93,7 +94,10 @@
} else if opts.TemplateURL != "" {
s["template_url"] = opts.TemplateURL
} else {
- return s, errors.New("Either Template or TemplateURL must be provided.")
+ err := gophercloud.ErrMissingInput{}
+ err.Argument = "stacks.CreateOpts.Template/stacks.CreateOpts.TemplateURL"
+ err.Info = "Either Template or TemplateURL must be provided"
+ return nil, err
}
} else {
if err := opts.TemplateOpts.Parse(); err != nil {
@@ -233,7 +237,9 @@
s := make(map[string]interface{})
if opts.Name == "" {
- return s, errors.New("Required field 'Name' not provided.")
+ err := gophercloud.ErrMissingInput{}
+ err.Argument = "stacks.AdoptOpts.Name"
+ return nil, err
}
s["stack_name"] = opts.Name
Files := make(map[string]string)
@@ -245,7 +251,10 @@
} else if opts.TemplateURL != "" {
s["template_url"] = opts.TemplateURL
} else {
- return s, errors.New("One of AdoptStackData, Template, TemplateURL or TemplateOpts must be provided.")
+ err := gophercloud.ErrMissingInput{}
+ err.Argument = "stacks.AdoptOpts"
+ err.Info = "One of AdoptStackData, Template, TemplateURL or TemplateOpts must be provided"
+ return nil, err
}
} else {
if err := opts.TemplateOpts.Parse(); err != nil {
@@ -452,7 +461,10 @@
} else if opts.TemplateURL != "" {
s["template_url"] = opts.TemplateURL
} else {
- return s, errors.New("Either Template or TemplateURL must be provided.")
+ err := gophercloud.ErrMissingInput{}
+ err.Argument = "stacks.UpdateOpts"
+ err.Info = "Either Template or TemplateURL must be provided"
+ return nil, err
}
} else {
if err := opts.TemplateOpts.Parse(); err != nil {
@@ -588,7 +600,9 @@
s := make(map[string]interface{})
if opts.Name == "" {
- return s, errors.New("Required field 'Name' not provided.")
+ err := gophercloud.ErrMissingInput{}
+ err.Argument = "stacks.PreviewOpts.Name"
+ return nil, err
}
s["stack_name"] = opts.Name
Files := make(map[string]string)
@@ -598,7 +612,10 @@
} else if opts.TemplateURL != "" {
s["template_url"] = opts.TemplateURL
} else {
- return s, errors.New("Either Template or TemplateURL must be provided.")
+ err := gophercloud.ErrMissingInput{}
+ err.Argument = "stacks.PreviewOpts"
+ err.Info = "Either Template or TemplateURL must be provided"
+ return nil, err
}
} else {
if err := opts.TemplateOpts.Parse(); err != nil {
diff --git a/openstack/orchestration/v1/stacktemplates/requests.go b/openstack/orchestration/v1/stacktemplates/requests.go
index a4687ef..d307fad 100644
--- a/openstack/orchestration/v1/stacktemplates/requests.go
+++ b/openstack/orchestration/v1/stacktemplates/requests.go
@@ -1,10 +1,6 @@
package stacktemplates
-import (
- "fmt"
-
- "github.com/gophercloud/gophercloud"
-)
+import "github.com/gophercloud/gophercloud"
// Get retreives data for the given stack template.
func Get(c *gophercloud.ServiceClient, stackName, stackID string) GetResult {
@@ -38,7 +34,10 @@
vo["template_url"] = opts.TemplateURL
return vo, nil
}
- return vo, fmt.Errorf("One of Template or TemplateURL is required.")
+ err := gophercloud.ErrMissingInput{}
+ err.Argument = "stacktemplates.ValidateOpts.Template/stacktemplates.ValidateOpts.TemplateURL"
+ err.Info = "One of Template or TemplateURL is required."
+ return nil, err
}
// Validate validates the given stack template.