[#323] client: Use constant for error message

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-08-23 20:15:55 +03:00 committed by fyrchik
parent 2f843de3ed
commit 0236b03fa7
4 changed files with 6 additions and 5 deletions

View file

@ -69,6 +69,7 @@ func (x prmCommonMeta) writeToMetaHeader(h *v2session.RequestMetaHeader) {
const (
panicMsgMissingContext = "missing context"
panicMsgMissingContainer = "missing container"
panicMsgMissingObject = "missing object"
)
// groups all the details required to send a single request and process a response to it.

View file

@ -131,7 +131,7 @@ func (c *Client) ObjectDelete(ctx context.Context, prm PrmObjectDelete) (*ResObj
case prm.addr.GetContainerID() == nil:
panic(panicMsgMissingContainer)
case prm.addr.GetObjectID() == nil:
panic("missing object")
panic(panicMsgMissingObject)
}
// form request body

View file

@ -319,7 +319,7 @@ func (c *Client) ObjectGetInit(ctx context.Context, prm PrmObjectGet) (*ObjectRe
case !prm.cnrSet:
panic(panicMsgMissingContainer)
case !prm.objSet:
panic("missing object")
panic(panicMsgMissingObject)
}
var (
@ -458,7 +458,7 @@ func (c *Client) ObjectHead(ctx context.Context, prm PrmObjectHead) (*ResObjectH
case !prm.cnrSet:
panic(panicMsgMissingContainer)
case !prm.objSet:
panic("missing object")
panic(panicMsgMissingObject)
}
var (
@ -729,7 +729,7 @@ func (c *Client) ObjectRangeInit(ctx context.Context, prm PrmObjectRange) (*Obje
case !prm.cnrSet:
panic(panicMsgMissingContainer)
case !prm.objSet:
panic("missing object")
panic(panicMsgMissingObject)
case prm.ln == 0:
panic("zero range length")
}

View file

@ -161,7 +161,7 @@ func (c *Client) ObjectHash(ctx context.Context, prm PrmObjectHash) (*ResObjectH
case prm.addr.GetContainerID() == nil:
panic(panicMsgMissingContainer)
case prm.addr.GetObjectID() == nil:
panic("missing object")
panic(panicMsgMissingObject)
case len(prm.body.GetRanges()) == 0:
panic("missing ranges")
}