From bd99f64517a236ad9218f9bcd1fd85009a7ba8d4 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Thu, 12 Dec 2019 14:02:30 -0500 Subject: [PATCH] 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 --- rados/rados.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rados/rados.go b/rados/rados.go index 10de50d..22714c2 100644 --- a/rados/rados.go +++ b/rados/rados.go @@ -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