mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 18:43:34 +00:00
rebase: bump github.com/ceph/go-ceph
Bumps [github.com/ceph/go-ceph](https://github.com/ceph/go-ceph) from 0.29.1-0.20240925141413-065319c78733 to 0.30.0. - [Release notes](https://github.com/ceph/go-ceph/releases) - [Changelog](https://github.com/ceph/go-ceph/blob/master/docs/release-process.md) - [Commits](https://github.com/ceph/go-ceph/commits/v0.30.0) --- updated-dependencies: - dependency-name: github.com/ceph/go-ceph dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
3bcf6afe30
commit
9152b4c2c7
57
vendor/github.com/ceph/go-ceph/internal/errutil/error.go
generated
vendored
Normal file
57
vendor/github.com/ceph/go-ceph/internal/errutil/error.go
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
package errutil
|
||||
|
||||
type cephErrno int
|
||||
|
||||
// Error returns the error string for the errno.
|
||||
func (e cephErrno) Error() string {
|
||||
_, strerror := FormatErrno(int(e))
|
||||
return strerror
|
||||
}
|
||||
|
||||
// cephError combines the source/component that generated the error and its
|
||||
// related errno.
|
||||
type cephError struct {
|
||||
source string
|
||||
errno cephErrno
|
||||
}
|
||||
|
||||
// Error returns the error string with the source and errno.
|
||||
func (e cephError) Error() string {
|
||||
return FormatErrorCode(e.source, int(e.errno))
|
||||
}
|
||||
|
||||
// Unwrap returns an error without the source.
|
||||
func (e cephError) Unwrap() error {
|
||||
if e.errno == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return e.errno
|
||||
}
|
||||
|
||||
// Is checks if both errors have the same errno.
|
||||
func (e cephError) Is(err error) bool {
|
||||
ce, ok := err.(cephError)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
return e.errno == ce.errno
|
||||
}
|
||||
|
||||
// ErrorCode returns the errno of the error.
|
||||
func (e cephError) ErrorCode() int {
|
||||
return int(e.errno)
|
||||
}
|
||||
|
||||
// GetError returns a new error that can be compared with errors.Is(),
|
||||
// independently of the source/component of the error.
|
||||
func GetError(source string, e int) error {
|
||||
if e == 0 {
|
||||
return nil
|
||||
}
|
||||
return cephError{
|
||||
source: source,
|
||||
errno: cephErrno(int(e)),
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user