From 558b366fbbb02bf57173d1cc4f170ce923d78bf9 Mon Sep 17 00:00:00 2001 From: Mudit Agarwal Date: Thu, 30 Jul 2020 07:53:59 +0530 Subject: [PATCH] rados: modify validate() to return ErrInvalidIOContext error If ioctx is not ready to be used then validate() should return ErrInvalidIOContext error. Signed-off-by: Mudit Agarwal --- rados/errors.go | 3 +++ rados/ioctx.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/rados/errors.go b/rados/errors.go index 03a2a01..2f643f3 100644 --- a/rados/errors.go +++ b/rados/errors.go @@ -54,6 +54,9 @@ var ( // ErrEmptyArgument may be returned if a function argument is passed // a zero-length slice or map. ErrEmptyArgument = errors.New("Argument must contain at least one item") + // ErrInvalidIOContext may be returned if an api call requires an IOContext + // but IOContext is not ready for use. + ErrInvalidIOContext = errors.New("IOContext is not ready for use") ) // Public radosErrors: diff --git a/rados/ioctx.go b/rados/ioctx.go index 598976d..26519d6 100644 --- a/rados/ioctx.go +++ b/rados/ioctx.go @@ -96,7 +96,7 @@ type IOContext struct { // with ceph C calls. func (ioctx *IOContext) validate() error { if ioctx.ioctx == nil { - return ErrNotConnected + return ErrInvalidIOContext } return nil }