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.
|
|
|
|
// Instances provide [Status], [StatusV2] and error interfaces.
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-01 11:55:21 +00:00
|
|
|
// implements local interface defined in FromStatusV2 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
|
|
|
|
}
|