mirror of https://github.com/ceph/go-ceph
rados: convert to common errno handling
Use the errno handling function originally created for rbd and then made common in rados package. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
b6ad17881a
commit
bd99f64517
|
@ -10,12 +10,18 @@ import (
|
|||
"fmt"
|
||||
"runtime"
|
||||
"unsafe"
|
||||
|
||||
"github.com/ceph/go-ceph/errutil"
|
||||
)
|
||||
|
||||
type RadosError int
|
||||
|
||||
func (e RadosError) Error() string {
|
||||
return fmt.Sprintf("rados: %s", C.GoString(C.strerror(C.int(-e))))
|
||||
errno, s := errutil.FormatErrno(int(e))
|
||||
if s == "" {
|
||||
return fmt.Sprintf("rados: ret=%d", errno)
|
||||
}
|
||||
return fmt.Sprintf("rados: ret=%d, %s", errno, s)
|
||||
}
|
||||
|
||||
var RadosAllNamespaces = C.LIBRADOS_ALL_NSPACES
|
||||
|
|
Loading…
Reference in New Issue