forked from TrueCloudLab/frostfs-sdk-go
[#315] apistatus: Support NodeUnderMaintenance
in FromStatusV2
Support decoding `NodeUnderMaintenance` status errors in `FromStatusV2` function. From now `NodeUnderMaintenance` instance can be decoded from `status.Status` message of NeoFS API V2 protocol. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3d6b5d807b
commit
be9a1aca90
2 changed files with 14 additions and 0 deletions
|
@ -58,6 +58,8 @@ func FromStatusV2(st *status.Status) Status {
|
|||
decoder = new(WrongMagicNumber)
|
||||
case status.SignatureVerificationFail:
|
||||
decoder = new(SignatureVerification)
|
||||
case status.NodeUnderMaintenance:
|
||||
decoder = new(NodeUnderMaintenance)
|
||||
}
|
||||
case object.LocalizeFailStatus(&code):
|
||||
switch code {
|
||||
|
|
|
@ -125,6 +125,12 @@ func TestToStatusV2(t *testing.T) {
|
|||
}),
|
||||
codeV2: 4097,
|
||||
},
|
||||
{
|
||||
status: (statusConstructor)(func() apistatus.Status {
|
||||
return new(apistatus.NodeUnderMaintenance)
|
||||
}),
|
||||
codeV2: 1027,
|
||||
},
|
||||
} {
|
||||
var st apistatus.Status
|
||||
|
||||
|
@ -272,6 +278,12 @@ func TestFromStatusV2(t *testing.T) {
|
|||
}),
|
||||
codeV2: 4097,
|
||||
},
|
||||
{
|
||||
status: (statusConstructor)(func() apistatus.Status {
|
||||
return new(apistatus.NodeUnderMaintenance)
|
||||
}),
|
||||
codeV2: 1027,
|
||||
},
|
||||
} {
|
||||
var st apistatus.Status
|
||||
|
||||
|
|
Loading…
Reference in a new issue