[#1535] morph/netmap: Unify error messages for config retrieval

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-12-04 11:07:43 +03:00 committed by Evgenii Stratonikov
parent 6c679d1535
commit e37dcdf88b

View file

@ -28,7 +28,7 @@ const (
func (c *Client) MaxObjectSize() (uint64, error) {
objectSize, err := c.readUInt64Config(MaxObjectSizeConfig)
if err != nil {
return 0, fmt.Errorf("(%T) could not get epoch number: %w", c, err)
return 0, err
}
return objectSize, nil
@ -38,7 +38,7 @@ func (c *Client) MaxObjectSize() (uint64, error) {
func (c *Client) EpochDuration() (uint64, error) {
epochDuration, err := c.readUInt64Config(EpochDurationConfig)
if err != nil {
return 0, fmt.Errorf("(%T) could not get epoch duration: %w", c, err)
return 0, err
}
return epochDuration, nil
@ -49,7 +49,7 @@ func (c *Client) EpochDuration() (uint64, error) {
func (c *Client) ContainerFee() (uint64, error) {
fee, err := c.readUInt64Config(ContainerFeeConfig)
if err != nil {
return 0, fmt.Errorf("(%T) could not get container fee: %w", c, err)
return 0, err
}
return fee, nil
@ -60,7 +60,7 @@ func (c *Client) ContainerFee() (uint64, error) {
func (c *Client) ContainerAliasFee() (uint64, error) {
fee, err := c.readUInt64Config(ContainerAliasFeeConfig)
if err != nil {
return 0, fmt.Errorf("(%T) could not get container alias fee: %w", c, err)
return 0, err
}
return fee, nil
@ -79,7 +79,7 @@ func (c *Client) HomomorphicHashDisabled() (bool, error) {
func (c *Client) InnerRingCandidateFee() (uint64, error) {
fee, err := c.readUInt64Config(IrCandidateFeeConfig)
if err != nil {
return 0, fmt.Errorf("(%T) could not get inner ring candidate fee: %w", c, err)
return 0, err
}
return fee, nil
@ -90,7 +90,7 @@ func (c *Client) InnerRingCandidateFee() (uint64, error) {
func (c *Client) WithdrawFee() (uint64, error) {
fee, err := c.readUInt64Config(WithdrawFeeConfig)
if err != nil {
return 0, fmt.Errorf("(%T) could not get withdraw fee: %w", c, err)
return 0, err
}
return fee, nil
@ -108,7 +108,7 @@ func (c *Client) MaintenanceModeAllowed() (bool, error) {
func (c *Client) readUInt64Config(key string) (uint64, error) {
v, err := c.config([]byte(key), IntegerAssert)
if err != nil {
return 0, err
return 0, fmt.Errorf("read netconfig value '%s': %w", key, err)
}
// IntegerAssert is guaranteed to return int64 if the error is nil.
@ -124,7 +124,7 @@ func (c *Client) readBoolConfig(key string) (bool, error) {
return false, nil
}
return false, fmt.Errorf("read boolean configuration value %s from the Sidechain: %w", key, err)
return false, fmt.Errorf("read netconfig value '%s': %w", key, err)
}
// BoolAssert is guaranteed to return bool if the error is nil.