v1 object storage error types
diff --git a/openstack/objectstorage/v1/objects/errors.go b/openstack/objectstorage/v1/objects/errors.go
new file mode 100644
index 0000000..5c4ae44
--- /dev/null
+++ b/openstack/objectstorage/v1/objects/errors.go
@@ -0,0 +1,13 @@
+package objects
+
+import "github.com/gophercloud/gophercloud"
+
+// ErrWrongChecksum is the error when the checksum generated for an object
+// doesn't match the ETAG header.
+type ErrWrongChecksum struct {
+ gophercloud.BaseError
+}
+
+func (e ErrWrongChecksum) Error() string {
+ return "Local checksum does not match API ETag header"
+}
diff --git a/openstack/objectstorage/v1/objects/requests.go b/openstack/objectstorage/v1/objects/requests.go
index 9a6da58..d82aeb2 100644
--- a/openstack/objectstorage/v1/objects/requests.go
+++ b/openstack/objectstorage/v1/objects/requests.go
@@ -242,7 +242,10 @@
res.Err = err
return res
}
- res.Err = fmt.Errorf("Local checksum does not match API ETag header")
+ err := ErrWrongChecksum{}
+ err.Function = "objects.Create"
+ res.Err = err
+
}
return res
@@ -267,7 +270,10 @@
// ToObjectCopyMap formats a CopyOpts into a map of headers.
func (opts CopyOpts) ToObjectCopyMap() (map[string]string, error) {
if opts.Destination == "" {
- return nil, fmt.Errorf("Required CopyOpts field 'Destination' not set.")
+ err := gophercloud.ErrMissingInput{}
+ err.Function = "objects.ToObjectCopyMap"
+ err.Argument = "objects.CopyOpts.Destination"
+ return nil, err
}
h, err := gophercloud.BuildHeaders(opts)
if err != nil {