cephfs: rename error types Errno method to ErrorCode

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

View File

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

View File

@ -15,10 +15,10 @@ func TestCephFSError(t *testing.T) {
assert.Error(t, err)
assert.Equal(t, err.Error(), "cephfs: 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)