2021-11-16 18:15:56 +00:00
|
|
|
package apistatus
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/status"
|
|
|
|
)
|
|
|
|
|
2023-05-16 08:21:59 +00:00
|
|
|
// ErrUnrecognizedStatusV2 is an instance of UnrecognizedStatusV2 error status. It's expected to be used for [errors.Is]
|
|
|
|
// and MUST NOT be changed.
|
|
|
|
var ErrUnrecognizedStatusV2 UnrecognizedStatusV2
|
|
|
|
|
|
|
|
// UnrecognizedStatusV2 describes status of the uncertain failure.
|
2023-05-23 03:32:33 +00:00
|
|
|
// Instances provide [StatusV2] and error interfaces.
|
2023-05-16 08:21:59 +00:00
|
|
|
type UnrecognizedStatusV2 struct {
|
2021-11-16 18:15:56 +00:00
|
|
|
v2 status.Status
|
|
|
|
}
|
|
|
|
|
2023-05-16 08:21:59 +00:00
|
|
|
func (x UnrecognizedStatusV2) Error() string {
|
2021-11-16 18:15:56 +00:00
|
|
|
return errMessageStatusV2("unrecognized", x.v2.Message())
|
|
|
|
}
|
|
|
|
|
2023-05-16 08:21:59 +00:00
|
|
|
// Is implements interface for correct checking current error type with [errors.Is].
|
|
|
|
func (x UnrecognizedStatusV2) Is(target error) bool {
|
|
|
|
switch target.(type) {
|
|
|
|
default:
|
|
|
|
return false
|
|
|
|
case UnrecognizedStatusV2, *UnrecognizedStatusV2:
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-24 05:50:14 +00:00
|
|
|
// implements local interface defined in [ErrorFromV2] func.
|
2023-05-16 08:21:59 +00:00
|
|
|
func (x *UnrecognizedStatusV2) fromStatusV2(st *status.Status) {
|
2021-11-16 18:15:56 +00:00
|
|
|
x.v2 = *st
|
|
|
|
}
|