mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-18 04:10:22 +00:00
rbd: add Unwrap() to error types
See-also: https://github.com/golang/go/wiki/ErrorValueFAQ#i-have-a-type-that-implements-error-and-holds-a-nested-error-how-should-i-adapt-it-to-the-new-features Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
fad0cf7f1c
commit
6d6b5bab3c
@ -27,6 +27,11 @@ func (e ErrImageNotFound) Error() string {
|
||||
return e.err.Error()
|
||||
}
|
||||
|
||||
// Unwrap returns the encapsulated error of ErrImageNotFound.
|
||||
func (e ErrImageNotFound) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
||||
// ErrSnapNotFound is returned when snap name passed is not found in the list of snapshots for the
|
||||
// given image
|
||||
type ErrSnapNotFound struct {
|
||||
@ -39,6 +44,11 @@ func (e ErrSnapNotFound) Error() string {
|
||||
return e.err.Error()
|
||||
}
|
||||
|
||||
// Unwrap returns the encapsulated error of ErrSnapNotFound.
|
||||
func (e ErrSnapNotFound) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
||||
// ErrVolNameConflict is generated when a requested CSI volume name already exists on RBD but with
|
||||
// different properties, and hence is in conflict with the passed in CSI volume name
|
||||
type ErrVolNameConflict struct {
|
||||
@ -51,6 +61,11 @@ func (e ErrVolNameConflict) Error() string {
|
||||
return e.err.Error()
|
||||
}
|
||||
|
||||
// Unwrap returns the encapsulated error of ErrVolNameConflict.
|
||||
func (e ErrVolNameConflict) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
||||
// ErrInvalidVolID is returned when a CSI passed VolumeID does not conform to any known volume ID
|
||||
// formats
|
||||
type ErrInvalidVolID struct {
|
||||
@ -62,6 +77,11 @@ func (e ErrInvalidVolID) Error() string {
|
||||
return e.err.Error()
|
||||
}
|
||||
|
||||
// Unwrap returns the encapsulated error of ErrInvalidVolID.
|
||||
func (e ErrInvalidVolID) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
||||
// ErrMissingStash is returned when the image metadata stash file is not found
|
||||
type ErrMissingStash struct {
|
||||
err error
|
||||
@ -72,6 +92,11 @@ func (e ErrMissingStash) Error() string {
|
||||
return e.err.Error()
|
||||
}
|
||||
|
||||
// Unwrap returns the encapsulated error of ErrMissingStash.
|
||||
func (e ErrMissingStash) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
||||
// ErrFlattenInProgress is returned when flatten is inprogess for an image
|
||||
type ErrFlattenInProgress struct {
|
||||
err error
|
||||
@ -81,3 +106,8 @@ type ErrFlattenInProgress struct {
|
||||
func (e ErrFlattenInProgress) Error() string {
|
||||
return e.err.Error()
|
||||
}
|
||||
|
||||
// Unwrap returns the encapsulated error of ErrFlattenInProgress.
|
||||
func (e ErrFlattenInProgress) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user