[#315] apistatus: Write default message in NodeUnderMaintenance.Error

Use `node is under maintenance` message in `NodeUnderMaintenance.Error`
is `message` field is unset in the status message.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-09-19 21:35:33 +04:00 committed by LeL
parent be9a1aca90
commit f2f97f656d

View file

@ -183,9 +183,14 @@ type NodeUnderMaintenance struct {
// Error implements the error interface.
func (x NodeUnderMaintenance) Error() string {
msg := x.Message()
if msg == "" {
msg = "node is under maintenance"
}
return errMessageStatusV2(
globalizeCodeV2(status.NodeUnderMaintenance, status.GlobalizeCommonFail),
x.v2.Message(),
msg,
)
}