[#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>
remotes/fyrchik/netmap-external-addr
Leonard Lyubich 2022-09-19 21:35:33 +04:00 committed by LeL
parent be9a1aca90
commit f2f97f656d
1 changed files with 6 additions and 1 deletions

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,
)
}