rbd: 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:57 -04:00 committed by John Mulligan
parent 54c268cb81
commit ab49935b5b
3 changed files with 5 additions and 5 deletions

View File

@ -335,8 +335,8 @@ func testDiffIterateEarlyExit(t *testing.T, ioctx *rados.IOContext) {
},
})
assert.Error(t, err)
if errno, ok := err.(interface{ Errno() int }); assert.True(t, ok) {
assert.EqualValues(t, -5, errno.Errno())
if errno, ok := err.(interface{ ErrorCode() int }); assert.True(t, ok) {
assert.EqualValues(t, -5, errno.ErrorCode())
}
if assert.Len(t, calls, 1) {
assert.EqualValues(t, 0, calls[0].offset)

View File

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

View File

@ -15,10 +15,10 @@ func TestRBDError(t *testing.T) {
assert.Error(t, err)
assert.Equal(t, err.Error(), "rbd: ret=39, Directory not empty")
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(), -39)
assert.Equal(t, errno.ErrorCode(), -39)
err = getError(345) // no such errno
assert.Error(t, err)