From f2f97f656da7f72216bc7ed527aabe50a4bc6fc7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 19 Sep 2022 21:35:33 +0400 Subject: [PATCH] [#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 --- client/status/common.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/status/common.go b/client/status/common.go index 7c86f3c..3164f92 100644 --- a/client/status/common.go +++ b/client/status/common.go @@ -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, ) }