forked from TrueCloudLab/frostfs-node
[#1693] services: Replace conditional panics with asserts
Change-Id: Ic79609e6ad867caa88ad245b3014aa7fc32e05a8 Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
parent
fc6abe30b8
commit
bc045b29e2
4 changed files with 14 additions and 13 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/assert"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/version"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/util/response"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap"
|
||||
|
@ -46,10 +47,12 @@ type NetworkInfo interface {
|
|||
}
|
||||
|
||||
func NewExecutionService(s NodeState, v versionsdk.Version, netInfo NetworkInfo, respSvc *response.Service) Server {
|
||||
if s == nil || netInfo == nil || !version.IsValid(v) || respSvc == nil {
|
||||
// this should never happen, otherwise it programmers bug
|
||||
panic("can't create netmap execution service")
|
||||
}
|
||||
// this should never happen, otherwise it's a programmer's bug
|
||||
msg := "BUG: can't create netmap execution service"
|
||||
assert.False(s == nil, msg, "node state is nil")
|
||||
assert.False(netInfo == nil, msg, "network info is nil")
|
||||
assert.False(respSvc == nil, msg, "response service is nil")
|
||||
assert.True(version.IsValid(v), msg, "invalid version")
|
||||
|
||||
res := &executorSvc{
|
||||
state: s,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue