diff --git a/x/deposit/keeper/deposit.go b/x/deposit/keeper/deposit.go index d5dcdc49..4b26b246 100644 --- a/x/deposit/keeper/deposit.go +++ b/x/deposit/keeper/deposit.go @@ -89,7 +89,7 @@ func (k *Keeper) SendCoinsFromAccountToDeposit(ctx sdk.Context, fromAddr, toAddr deposit.Coins = deposit.Coins.Add(coins...) if deposit.Coins.IsAnyNegative() { - return types.NewErrorInsufficientFunds(fromAddr, deposit.Coins) + return types.NewErrorInsufficientFunds(fromAddr) } k.SetDeposit(ctx, deposit) @@ -113,7 +113,7 @@ func (k *Keeper) SendCoinsFromDepositToAccount(ctx sdk.Context, fromAddr, toAddr deposit.Coins, _ = deposit.Coins.SafeSub(coins) if deposit.Coins.IsAnyNegative() { - return types.NewErrorInsufficientFunds(fromAddr, coins) + return types.NewErrorInsufficientDeposit(fromAddr) } if err := k.bank.SendCoinsFromModuleToAccount(ctx, types.ModuleName, toAddr, coins); err != nil { @@ -141,7 +141,7 @@ func (k *Keeper) SendCoinsFromDepositToModule(ctx sdk.Context, fromAddr sdk.AccA deposit.Coins, _ = deposit.Coins.SafeSub(coins) if deposit.Coins.IsAnyNegative() { - return types.NewErrorInsufficientFunds(fromAddr, coins) + return types.NewErrorInsufficientDeposit(fromAddr) } if err := k.bank.SendCoinsFromModuleToModule(ctx, types.ModuleName, toModule, coins); err != nil { diff --git a/x/deposit/types/errors.go b/x/deposit/types/errors.go index 07e527fd..e2ad3411 100644 --- a/x/deposit/types/errors.go +++ b/x/deposit/types/errors.go @@ -3,19 +3,23 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/errors" ) var ( - ErrorInsufficientFunds = errors.Register(ModuleName, 201, "insufficient funds") - ErrorNotFound = errors.Register(ModuleName, 202, "not found") + ErrorDepositNotFound = errors.Register(ModuleName, 201, "deposit not found") + ErrorInsufficientDeposit = errors.Register(ModuleName, 202, "insufficient deposit") + ErrorInsufficientFunds = errors.Register(ModuleName, 203, "insufficient funds") ) -func NewErrorInsufficientFunds(addr sdk.AccAddress, coins sdk.Coins) error { - return errors.Wrapf(ErrorInsufficientFunds, "insufficient deposit funds %s for address %s", coins, addr) +func NewErrorDepositNotFound(addr interface{}) error { + return errors.Wrapf(ErrorDepositNotFound, "deposit for address %s does not exist", addr) } -func NewErrorDepositNotFound(addr sdk.AccAddress) error { - return errors.Wrapf(ErrorNotFound, "deposit for address %s does not exist", addr) +func NewErrorInsufficientDeposit(addr interface{}) error { + return errors.Wrapf(ErrorInsufficientDeposit, "insufficient deposit for address %s", addr) +} + +func NewErrorInsufficientFunds(addr interface{}) error { + return errors.Wrapf(ErrorInsufficientFunds, "insufficient funds for address %s", addr) } diff --git a/x/node/types/errors.go b/x/node/types/errors.go index c32b8d22..a99f643f 100644 --- a/x/node/types/errors.go +++ b/x/node/types/errors.go @@ -5,38 +5,34 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/errors" - - hubtypes "github.com/sentinel-official/hub/types" ) var ( ErrorInvalidMessage = errors.Register(ModuleName, 101, "invalid message") -) -var ( - ErrorDuplicate = errors.Register(ModuleName, 201, "duplicate") + ErrorDuplicateNode = errors.Register(ModuleName, 201, "duplicate node") ErrorInvalidGigabytes = errors.Register(ModuleName, 202, "invalid gigabytes") ErrorInvalidHours = errors.Register(ModuleName, 203, "invalid hours") ErrorInvalidPrices = errors.Register(ModuleName, 204, "invalid prices") - ErrorNotFound = errors.Register(ModuleName, 205, "not found") + ErrorNodeNotFound = errors.Register(ModuleName, 205, "node not found") ) -func NewErrorInvalidPrices(prices sdk.Coins) error { - return errors.Wrapf(ErrorInvalidPrices, "invalid prices %s", prices) +func NewErrorDuplicateNode(addr interface{}) error { + return errors.Wrapf(ErrorDuplicateNode, "node %s already exist", addr) } -func NewErrorNodeNotFound(addr hubtypes.NodeAddress) error { - return errors.Wrapf(ErrorNotFound, "node %s does not exist", addr) +func NewErrorInvalidGigabytes(gigabytes int64) error { + return errors.Wrapf(ErrorInvalidGigabytes, "invalid gigabytes %d", gigabytes) } -func NewErrorDuplicateNode(addr hubtypes.NodeAddress) error { - return errors.Wrapf(ErrorDuplicate, "node %s already exists", addr) +func NewErrorInvalidHours(hours int64) error { + return errors.Wrapf(ErrorInvalidHours, "invalid hours %d", hours) } -func NewErrorInvalidGigabytes(gigabytes int64) error { - return errors.Wrapf(ErrorInvalidGigabytes, "invalid subscription gigabytes %d", gigabytes) +func NewErrorInvalidPrices(prices sdk.Coins) error { + return errors.Wrapf(ErrorInvalidPrices, "invalid prices %s", prices) } -func NewErrorInvalidHours(hours int64) error { - return errors.Wrapf(ErrorInvalidHours, "invalid subscription hours %d", hours) +func NewErrorNodeNotFound(addr interface{}) error { + return errors.Wrapf(ErrorNodeNotFound, "node %s does not exist", addr) } diff --git a/x/plan/types/errors.go b/x/plan/types/errors.go index d9e563e1..f62e6114 100644 --- a/x/plan/types/errors.go +++ b/x/plan/types/errors.go @@ -4,31 +4,29 @@ package types import ( "github.com/cosmos/cosmos-sdk/types/errors" - - hubtypes "github.com/sentinel-official/hub/types" ) var ( ErrorInvalidMessage = errors.Register(ModuleName, 101, "invalid message") -) -var ( - ErrorNotFound = errors.Register(ModuleName, 201, "not found") - ErrorUnauthorized = errors.Register(ModuleName, 202, "unauthorized") + ErrorNodeNotFound = errors.Register(ModuleName, 201, "node not found") + ErrorPlanNotFound = errors.Register(ModuleName, 202, "plan not found") + ErrorProviderNotFound = errors.Register(ModuleName, 203, "provider not found") + ErrorUnauthorized = errors.Register(ModuleName, 204, "unauthorised") ) -func NewErrorProviderNotFound(addr hubtypes.ProvAddress) error { - return errors.Wrapf(ErrorNotFound, "provider %s does not exist", addr) +func NewErrorNodeNotFound(addr interface{}) error { + return errors.Wrapf(ErrorNodeNotFound, "node %s does not exist", addr) } func NewErrorPlanNotFound(id uint64) error { - return errors.Wrapf(ErrorNotFound, "plan %d does not exist", id) + return errors.Wrapf(ErrorPlanNotFound, "plan %d does not exist", id) } -func NewErrorUnauthorized(addr string) error { - return errors.Wrapf(ErrorUnauthorized, "address %s is not authorised", addr) +func NewErrorProviderNotFound(addr interface{}) error { + return errors.Wrapf(ErrorProviderNotFound, "provider %s does not exist", addr) } -func NewErrorNodeNotFound(addr hubtypes.NodeAddress) error { - return errors.Wrapf(ErrorNotFound, "node %s does not exist", addr) +func NewErrorUnauthorized(addr interface{}) error { + return errors.Wrapf(ErrorUnauthorized, "address %s is not authorized", addr) } diff --git a/x/provider/types/errors.go b/x/provider/types/errors.go index ff1f1f18..084ada82 100644 --- a/x/provider/types/errors.go +++ b/x/provider/types/errors.go @@ -4,23 +4,19 @@ package types import ( "github.com/cosmos/cosmos-sdk/types/errors" - - hubtypes "github.com/sentinel-official/hub/types" ) var ( ErrorInvalidMessage = errors.Register(ModuleName, 101, "invalid message") -) -var ( - ErrorDuplicate = errors.Register(ModuleName, 201, "duplicate") - ErrorNotFound = errors.Register(ModuleName, 202, "not found") + ErrorDuplicateProvider = errors.Register(ModuleName, 201, "duplicate provider") + ErrorProviderNotFound = errors.Register(ModuleName, 202, "provider not found") ) -func NewErrorDuplicateProvider(addr hubtypes.ProvAddress) error { - return errors.Wrapf(ErrorDuplicate, "provider %s already exists", addr) +func NewErrorDuplicateProvider(addr interface{}) error { + return errors.Wrapf(ErrorDuplicateProvider, "provider %s already exist", addr) } -func NewErrorProviderNotFound(addr hubtypes.ProvAddress) error { - return errors.Wrapf(ErrorNotFound, "provider %s does not exist", addr) +func NewErrorProviderNotFound(addr interface{}) error { + return errors.Wrapf(ErrorProviderNotFound, "provider %s does not exist", addr) } diff --git a/x/session/keeper/msg_server.go b/x/session/keeper/msg_server.go index bc482e9e..e7263495 100644 --- a/x/session/keeper/msg_server.go +++ b/x/session/keeper/msg_server.go @@ -79,7 +79,7 @@ func (k *msgServer) MsgStart(c context.Context, msg *types.MsgStartRequest) (*ty provAddr := plan.GetProviderAddress() if _, found = k.GetLatestPayoutForAccountByNode(ctx, provAddr.Bytes(), nodeAddr); !found { - return nil, types.NewErrorPayoutNotFound(provAddr.Bytes(), nodeAddr) + return nil, types.NewErrorPayoutForAddressByNodeNotFound(provAddr, nodeAddr) } // Ensure that the node is associated with the plan. @@ -87,8 +87,8 @@ func (k *msgServer) MsgStart(c context.Context, msg *types.MsgStartRequest) (*ty return nil, types.NewErrorInvalidNode(node.Address) } default: - // If the subscription type is not recognized, return an error indicating an invalid subscription type. - return nil, types.NewErrorInvalidSubscriptionType(subscription.GetID(), subscription.Type().String()) + // If the subscription type is not recognized, return an error indicating an invalid subscription. + return nil, types.NewErrorInvalidSubscription(subscription.GetID()) } // Parse the account address from the Bech32 encoded address provided in the message. @@ -131,7 +131,7 @@ func (k *msgServer) MsgStart(c context.Context, msg *types.MsgStartRequest) (*ty session, found := k.GetLatestSessionForAllocation(ctx, subscription.GetID(), accAddr) if found && session.Status.Equal(hubtypes.StatusActive) { // If an active session already exists, return an error indicating a duplicate active session. - return nil, types.NewErrorDuplicateActiveSession(subscription.GetID(), accAddr, session.ID) + return nil, types.NewErrorDuplicateActiveSession(session.ID) } // Increment the session count to assign a new session ID. diff --git a/x/session/types/errors.go b/x/session/types/errors.go index 9bf42263..c882963c 100644 --- a/x/session/types/errors.go +++ b/x/session/types/errors.go @@ -3,7 +3,6 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/errors" hubtypes "github.com/sentinel-official/hub/types" @@ -11,75 +10,80 @@ import ( var ( ErrorInvalidMessage = errors.Register(ModuleName, 101, "invalid message") -) -var ( - ErrorDuplicate = errors.Register(ModuleName, 201, "duplicate") - ErrorInvalidAllocation = errors.Register(ModuleName, 202, "invalid allocation") - ErrorInvalidSignature = errors.Register(ModuleName, 203, "invalid signature") - ErrorInvalidStatus = errors.Register(ModuleName, 204, "invalid status") - ErrorNotFound = errors.Register(ModuleName, 205, "not found") - ErrorUnauthorized = errors.Register(ModuleName, 209, "unauthorized") - ErrorInvalidNode = errors.Register(ModuleName, 210, "invalid node") - ErrorInvalidType = errors.Register(ModuleName, 211, "invalid type") + ErrorAllocationNotFound = errors.Register(ModuleName, 201, "allocation not found") + ErrorDuplicateActiveSession = errors.Register(ModuleName, 202, "duplicate active session") + ErrorInvalidAllocation = errors.Register(ModuleName, 203, "invalid allocation") + ErrorInvalidNode = errors.Register(ModuleName, 204, "invalid node") + ErrorInvalidNodeStatus = errors.Register(ModuleName, 205, "invalid node status") + ErrorInvalidSessionStatus = errors.Register(ModuleName, 206, "invalid session status") + ErrorInvalidSignature = errors.Register(ModuleName, 207, "invalid signature") + ErrorInvalidSubscription = errors.Register(ModuleName, 208, "invalid subscription") + ErrorInvalidSubscriptionStatus = errors.Register(ModuleName, 209, "invalid subscription status") + ErrorNodeNotFound = errors.Register(ModuleName, 210, "node not found") + ErrorPayoutForAddressByNodeNotFound = errors.Register(ModuleName, 211, "payout for address by node not found") + ErrorPlanNotFound = errors.Register(ModuleName, 212, "plan not found") + ErrorSessionNotFound = errors.Register(ModuleName, 213, "session not found") + ErrorSubscriptionNotFound = errors.Register(ModuleName, 214, "subscription not found") + ErrorUnauthorized = errors.Register(ModuleName, 215, "unauthorised") ) -func NewErrorSubscriptionNotFound(id uint64) error { - return errors.Wrapf(ErrorNotFound, "subscription %d does not exit", id) +func NewErrorAllocationNotFound(id uint64, addr interface{}) error { + return errors.Wrapf(ErrorAllocationNotFound, "allocation %d/%s does not exist", id, addr) } -func NewErrorInvalidSubscriptionStatus(id uint64, status hubtypes.Status) error { - return errors.Wrapf(ErrorInvalidStatus, "invalid status %s for subscription %d", status, id) +func NewErrorDuplicateActiveSession(id uint64) error { + return errors.Wrapf(ErrorDuplicateActiveSession, "active session %d already exist", id) } -func NewErrorNodeNotFound(addr hubtypes.NodeAddress) error { - return errors.Wrapf(ErrorNotFound, "node %s does not exist", addr) +func NewErrorInvalidAllocation(id uint64, addr interface{}) error { + return errors.Wrapf(ErrorInvalidAllocation, "invalid allocation %d/%s", id, addr) } -func NewErrorInvalidNodeStatus(addr hubtypes.NodeAddress, status hubtypes.Status) error { - return errors.Wrapf(ErrorInvalidStatus, "invalid status %s for node %s", status, addr) +func NewErrorInvalidNode(addr interface{}) error { + return errors.Wrapf(ErrorInvalidNode, "invalid node %s ", addr) } -func NewErrorAllocationNotFound(id uint64, addr sdk.AccAddress) error { - return errors.Wrapf(ErrorNotFound, "subscription allocation %d/%s does not exist", id, addr) +func NewErrorInvalidNodeStatus(addr interface{}, status hubtypes.Status) error { + return errors.Wrapf(ErrorInvalidNodeStatus, "invalid status %s for node %s ", status, addr) } -func NewErrorDuplicateActiveSession(subscriptionID uint64, addr sdk.AccAddress, sessionID uint64) error { - return errors.Wrapf(ErrorDuplicate, "active session %d already exist for subscription allocation %d/%s", sessionID, subscriptionID, addr) +func NewErrorInvalidSessionStatus(id uint64, status hubtypes.Status) error { + return errors.Wrapf(ErrorInvalidSessionStatus, "invalid status %s for session %d", status, id) } -func NewErrorInvalidAllocation(id uint64, addr sdk.AccAddress) error { - return errors.Wrapf(ErrorInvalidAllocation, "invalid subscription allocation %d/%s", id, addr) +func NewErrorInvalidSignature(signature []byte) error { + return errors.Wrapf(ErrorInvalidSignature, "invalid signature %X", signature) } -func NewErrorSessionNotFound(id uint64) error { - return errors.Wrapf(ErrorNotFound, "session %d does not exist", id) +func NewErrorInvalidSubscription(id uint64) error { + return errors.Wrapf(ErrorInvalidSubscription, "invalid subscription %d", id) } -func NewErrorUnauthorized(addr string) error { - return errors.Wrapf(ErrorUnauthorized, "address %s is not authorized", addr) +func NewErrorInvalidSubscriptionStatus(id uint64, status hubtypes.Status) error { + return errors.Wrapf(ErrorInvalidSubscriptionStatus, "invalid status %s for subscription %d", status, id) } -func NewErrorInvalidSignature(signature []byte) error { - return errors.Wrapf(ErrorInvalidSignature, "invalid bandwidth proof signature %X", signature) +func NewErrorNodeNotFound(addr interface{}) error { + return errors.Wrapf(ErrorNodeNotFound, "node %s does not exist", addr) } -func NewErrorInvalidSessionStatus(id uint64, status hubtypes.Status) error { - return errors.Wrapf(ErrorInvalidStatus, "invalid status %s for session %d", status, id) +func NewErrorPayoutForAddressByNodeNotFound(accAddr, nodeAddr interface{}) error { + return errors.Wrapf(ErrorPayoutForAddressByNodeNotFound, "payout for address %s by node %s not found", accAddr, nodeAddr) } func NewErrorPlanNotFound(id uint64) error { - return errors.Wrapf(ErrorNotFound, "plan %d does not exist", id) + return errors.Wrapf(ErrorPlanNotFound, "plan %d does not exist", id) } -func NewErrorPayoutNotFound(accAddr sdk.AccAddress, nodeAddr hubtypes.NodeAddress) error { - return errors.Wrapf(ErrorNotFound, "payout for account %s and node %s does not exist", accAddr, nodeAddr) +func NewErrorSessionNotFound(id uint64) error { + return errors.Wrapf(ErrorSessionNotFound, "session %d does not exist", id) } -func NewErrorInvalidNode(addr string) error { - return errors.Wrapf(ErrorInvalidNode, "invalid node %s", addr) +func NewErrorSubscriptionNotFound(id uint64) error { + return errors.Wrapf(ErrorSubscriptionNotFound, "subscription %s does not exist", id) } -func NewErrorInvalidSubscriptionType(id uint64, t string) error { - return errors.Wrapf(ErrorInvalidType, "invalid type %s for subscription %d", t, id) +func NewErrorUnauthorized(addr interface{}) error { + return errors.Wrapf(ErrorUnauthorized, "address %s is not authorized", addr) } diff --git a/x/subscription/types/errors.go b/x/subscription/types/errors.go index 4f768e07..4344c539 100644 --- a/x/subscription/types/errors.go +++ b/x/subscription/types/errors.go @@ -3,7 +3,6 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/errors" hubtypes "github.com/sentinel-official/hub/types" @@ -11,70 +10,70 @@ import ( var ( ErrorInvalidMessage = errors.Register(ModuleName, 101, "invalid message") -) -var ( - ErrorInsufficientBytes = errors.Register(ModuleName, 201, "insufficient bytes") - ErrorInvalidAllocation = errors.Register(ModuleName, 202, "invalid allocation") - ErrorInvalidCount = errors.Register(ModuleName, 203, "invalid count") - ErrorInvalidStatus = errors.Register(ModuleName, 204, "invalid status") - ErrorInvalidType = errors.Register(ModuleName, 205, "invalid type") - ErrorNotFound = errors.Register(ModuleName, 206, "not found") - ErrorUnauthorized = errors.Register(ModuleName, 207, "unauthorized") + ErrorAllocationNotFound = errors.Register(ModuleName, 201, "allocation not found") + ErrorInsufficientBytes = errors.Register(ModuleName, 202, "insufficient bytes") + ErrorInvalidAllocation = errors.Register(ModuleName, 203, "invalid allocation") + ErrorInvalidNodeStatus = errors.Register(ModuleName, 204, "invalid node status") + ErrorInvalidPlanStatus = errors.Register(ModuleName, 205, "invalid plan status") + ErrorInvalidSubscription = errors.Register(ModuleName, 206, "invalid subscription") + ErrorInvalidSubscriptionStatus = errors.Register(ModuleName, 207, "invalid subscription status") + ErrorNodeNotFound = errors.Register(ModuleName, 208, "node not found") + ErrorPayoutNotFound = errors.Register(ModuleName, 209, "payout not found") + ErrorPlanNotFound = errors.Register(ModuleName, 210, "plan not found") + ErrorPriceNotFound = errors.Register(ModuleName, 211, "price does not exist") + ErrorSubscriptionNotFound = errors.Register(ModuleName, 212, "subscription not found") + ErrorUnauthorized = errors.Register(ModuleName, 213, "unauthorised") ) -func NewErrorInsufficientBytes(id uint64, bytes sdk.Int) error { - return errors.Wrapf(ErrorInsufficientBytes, "insufficient bytes %d for subscription %d", bytes, id) -} - -func NewErrorInvalidAllocation(id uint64, addr sdk.AccAddress) error { - return errors.Wrapf(ErrorInvalidAllocation, "invalid allocation %d/%s", id, addr) +func NewErrorAllocationNotFound(id uint64, addr interface{}) error { + return errors.Wrapf(ErrorAllocationNotFound, "allocation %d/%s does not exist", id, addr) } -func NewErrorInvalidSubscriptionStatus(id uint64, status hubtypes.Status) error { - return errors.Wrapf(ErrorInvalidStatus, "invalid status %s for subscription %d", status, id) +func NewErrorInsufficientBytes(id uint64, addr interface{}) error { + return errors.Wrapf(ErrorInsufficientBytes, "insufficient bytes for allocation %d/%s", id, addr) } -func NewErrorInvalidSubscription(id uint64) error { - return errors.Wrapf(ErrorInvalidType, "invalid subscription %d", id) +func NewErrorInvalidAllocation(id uint64, addr interface{}) error { + return errors.Wrapf(ErrorInvalidAllocation, "invalid allocation %d/%s", id, addr) } -func NewErrorAllocationNotFound(id uint64, addr sdk.AccAddress) error { - return errors.Wrapf(ErrorNotFound, "subscription allocation %d/%s does not exist", id, addr) +func NewErrorInvalidNodeStatus(addr interface{}, status hubtypes.Status) error { + return errors.Wrapf(ErrorInvalidNodeStatus, "invalid status %s for node %s ", status, addr) } -func NewErrorSubscriptionNotFound(id uint64) error { - return errors.Wrapf(ErrorNotFound, "subscription %d does not exist", id) +func NewErrorInvalidPlanStatus(id uint64, status hubtypes.Status) error { + return errors.Wrapf(ErrorInvalidPlanStatus, "invalid status %s for plan %d ", status, id) } -func NewErrorUnauthorized(addr string) error { - return errors.Wrapf(ErrorUnauthorized, "address %s is not authorized", addr) +func NewErrorInvalidSubscription(id uint64) error { + return errors.Wrapf(ErrorInvalidSubscription, "invalid subscription %d", id) } -func NewErrorPlanNotFound(id uint64) error { - return errors.Wrapf(ErrorNotFound, "plan %d does not exist", id) +func NewErrorInvalidSubscriptionStatus(id uint64, status hubtypes.Status) error { + return errors.Wrapf(ErrorInvalidSubscriptionStatus, "invalid status %s for subscription %d", status, id) } -func NewErrorInvalidPlanStatus(id uint64, status hubtypes.Status) error { - return errors.Wrapf(ErrorInvalidStatus, "invalid status %s for plan %d", status, id) +func NewErrorNodeNotFound(addr interface{}) error { + return errors.Wrapf(ErrorNodeNotFound, "node %s does not exist", addr) } -func NewErrorPriceNotFound(denom string) error { - return errors.Wrapf(ErrorNotFound, "price for denom %s does not exist", denom) +func NewErrorPayoutNotFound(id uint64) error { + return errors.Wrapf(ErrorPayoutNotFound, "payout %d does not exist", id) } -func NewErrorNodeNotFound(addr hubtypes.NodeAddress) error { - return errors.Wrapf(ErrorNotFound, "node %s does not exist", addr) +func NewErrorPlanNotFound(id uint64) error { + return errors.Wrapf(ErrorPlanNotFound, "plan %d does not exist", id) } -func NewErrorInvalidNodeStatus(addr hubtypes.NodeAddress, status hubtypes.Status) error { - return errors.Wrapf(ErrorInvalidStatus, "invalid status %s for node %s", status, addr) +func NewErrorPriceNotFound(denom string) error { + return errors.Wrapf(ErrorPriceNotFound, "price for denom %s does not exist", denom) } -func NewErrorInvalidSessionCount(id uint64) error { - return errors.Wrapf(ErrorInvalidCount, "found non-zero session count for subscription %d", id) +func NewErrorSubscriptionNotFound(id uint64) error { + return errors.Wrapf(ErrorSubscriptionNotFound, "subscription %s does not exist", id) } -func NewErrorPayoutNotFound(id uint64) error { - return errors.Wrapf(ErrorNotFound, "payout %d does not exist", id) +func NewErrorUnauthorized(addr interface{}) error { + return errors.Wrapf(ErrorUnauthorized, "address %s is not authorized", addr) }