mirror of https://github.com/ceph/go-ceph
cephfs: rename error types Errno method to ErrorCode
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
d6e928993b
commit
1ecac966de
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue