mirror of https://github.com/ceph/go-ceph
cephfs: replace cephfsError by cephError
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
3dbd875587
commit
b712180b45
|
@ -11,23 +11,8 @@ import (
|
||||||
"github.com/ceph/go-ceph/internal/errutil"
|
"github.com/ceph/go-ceph/internal/errutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
// cephFSError represents an error condition returned from the CephFS APIs.
|
|
||||||
type cephFSError int
|
|
||||||
|
|
||||||
// Error returns the error string for the cephFSError type.
|
|
||||||
func (e cephFSError) Error() string {
|
|
||||||
return errutil.FormatErrorCode("cephfs", int(e))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e cephFSError) ErrorCode() int {
|
|
||||||
return int(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
func getError(e C.int) error {
|
func getError(e C.int) error {
|
||||||
if e == 0 {
|
return errutil.GetError("cephfs", int(e))
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return cephFSError(e)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// getErrorIfNegative converts a ceph return code to error if negative.
|
// getErrorIfNegative converts a ceph return code to error if negative.
|
||||||
|
@ -46,22 +31,16 @@ var (
|
||||||
// ErrEmptyArgument may be returned if a function argument is passed
|
// ErrEmptyArgument may be returned if a function argument is passed
|
||||||
// a zero-length slice or map.
|
// a zero-length slice or map.
|
||||||
ErrEmptyArgument = errors.New("Argument must contain at least one item")
|
ErrEmptyArgument = errors.New("Argument must contain at least one item")
|
||||||
)
|
|
||||||
|
|
||||||
// Public CephFSErrors:
|
|
||||||
|
|
||||||
const (
|
|
||||||
// ErrNotConnected may be returned when client is not connected
|
// ErrNotConnected may be returned when client is not connected
|
||||||
// to a cluster.
|
// to a cluster.
|
||||||
ErrNotConnected = cephFSError(-C.ENOTCONN)
|
ErrNotConnected = getError(-C.ENOTCONN)
|
||||||
// ErrNotExist indicates a non-specific missing resource.
|
// ErrNotExist indicates a non-specific missing resource.
|
||||||
ErrNotExist = cephFSError(-C.ENOENT)
|
ErrNotExist = getError(-C.ENOENT)
|
||||||
)
|
|
||||||
|
|
||||||
// Private errors:
|
// Private errors:
|
||||||
|
|
||||||
const (
|
errInvalid = getError(-C.EINVAL)
|
||||||
errInvalid = cephFSError(-C.EINVAL)
|
errNameTooLong = getError(-C.ENAMETOOLONG)
|
||||||
errNameTooLong = cephFSError(-C.ENAMETOOLONG)
|
errRange = getError(-C.ERANGE)
|
||||||
errRange = cephFSError(-C.ERANGE)
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue