From e37dcdf88bfb6e159b1e2812b43774227e7d3366 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 4 Dec 2024 11:07:43 +0300 Subject: [PATCH] [#1535] morph/netmap: Unify error messages for config retrieval Signed-off-by: Evgenii Stratonikov --- pkg/morph/client/netmap/config.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/morph/client/netmap/config.go b/pkg/morph/client/netmap/config.go index 0a3c351db..29bd1517d 100644 --- a/pkg/morph/client/netmap/config.go +++ b/pkg/morph/client/netmap/config.go @@ -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.