rados: rename error type's Errno method to ErrorCode

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-08-10 10:31:40 -04:00 committed by John Mulligan
parent 1ecac966de
commit 54c268cb81
2 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ func (e radosError) Error() string {
return fmt.Sprintf("rados: ret=%d, %s", errno, s)
}
func (e radosError) Errno() int {
func (e radosError) ErrorCode() int {
return int(e)
}

View File

@ -15,10 +15,10 @@ func TestRadosError(t *testing.T) {
assert.Error(t, err)
assert.Equal(t, err.Error(), "rados: ret=5, Input/output error")
errno, ok := err.(interface{ Errno() int })
errno, ok := err.(interface{ ErrorCode() int })
assert.True(t, ok)
require.NotNil(t, errno)
assert.Equal(t, errno.Errno(), -5)
assert.Equal(t, errno.ErrorCode(), -5)
err = getError(345) // no such errno
assert.Error(t, err)