error for already purchased claims
This commit is contained in:
parent
cd5f260061
commit
dc2ccc4fe8
3 changed files with 13 additions and 6 deletions
|
@ -59,6 +59,7 @@ Code | Name | Message
|
||||||
421 | InvalidPassword | Password is invalid.
|
421 | InvalidPassword | Password is invalid.
|
||||||
422 | IncompatibleWalletServer | '{server}:{port}' has an incompatibly old version.
|
422 | IncompatibleWalletServer | '{server}:{port}' has an incompatibly old version.
|
||||||
423 | TooManyClaimSearchParameters | {key} cant have more than {limit} items.
|
423 | TooManyClaimSearchParameters | {key} cant have more than {limit} items.
|
||||||
|
424 | AlreadyPurchased | You already have a purchase for claim_id '{claim_id}'. Use --allow-duplicate-purchase flag to override.
|
||||||
431 | ServerPaymentInvalidAddress | Invalid address from wallet server: '{address}' - skipping payment round.
|
431 | ServerPaymentInvalidAddress | Invalid address from wallet server: '{address}' - skipping payment round.
|
||||||
432 | ServerPaymentWalletLocked | Cannot spend funds with locked wallet, skipping payment round.
|
432 | ServerPaymentWalletLocked | Cannot spend funds with locked wallet, skipping payment round.
|
||||||
433 | ServerPaymentFeeAboveMaxAllowed | Daily server fee of {daily_fee} exceeds maximum configured of {max_fee} LBC.
|
433 | ServerPaymentFeeAboveMaxAllowed | Daily server fee of {daily_fee} exceeds maximum configured of {max_fee} LBC.
|
||||||
|
|
|
@ -258,6 +258,16 @@ class TooManyClaimSearchParametersError(WalletError):
|
||||||
super().__init__(f"{key} cant have more than {limit} items.")
|
super().__init__(f"{key} cant have more than {limit} items.")
|
||||||
|
|
||||||
|
|
||||||
|
class AlreadyPurchasedError(WalletError):
|
||||||
|
"""
|
||||||
|
allow-duplicate-purchase flag to override.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, claim_id):
|
||||||
|
self.claim_id = claim_id
|
||||||
|
super().__init__(f"You already have a purchase for claim_id '{claim_id}'. Use")
|
||||||
|
|
||||||
|
|
||||||
class ServerPaymentInvalidAddressError(WalletError):
|
class ServerPaymentInvalidAddressError(WalletError):
|
||||||
|
|
||||||
def __init__(self, address):
|
def __init__(self, address):
|
||||||
|
|
|
@ -38,7 +38,7 @@ from lbry.dht.peer import make_kademlia_peer
|
||||||
from lbry.error import (
|
from lbry.error import (
|
||||||
DownloadSDTimeoutError, ComponentsNotStartedError, ComponentStartConditionNotMetError,
|
DownloadSDTimeoutError, ComponentsNotStartedError, ComponentStartConditionNotMetError,
|
||||||
CommandDoesNotExistError, BaseError, WalletNotFoundError, WalletAlreadyLoadedError, WalletAlreadyExistsError,
|
CommandDoesNotExistError, BaseError, WalletNotFoundError, WalletAlreadyLoadedError, WalletAlreadyExistsError,
|
||||||
ConflictingInputValueError
|
ConflictingInputValueError, AlreadyPurchasedError
|
||||||
)
|
)
|
||||||
from lbry.extras import system_info
|
from lbry.extras import system_info
|
||||||
from lbry.extras.daemon import analytics
|
from lbry.extras.daemon import analytics
|
||||||
|
@ -2295,11 +2295,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
# TODO: use error from lbry.error
|
# TODO: use error from lbry.error
|
||||||
raise Exception("Missing argument claim_id or url.")
|
raise Exception("Missing argument claim_id or url.")
|
||||||
if not allow_duplicate_purchase and txo.purchase_receipt:
|
if not allow_duplicate_purchase and txo.purchase_receipt:
|
||||||
# TODO: use error from lbry.error
|
raise AlreadyPurchasedError(claim_id)
|
||||||
raise Exception(
|
|
||||||
f"You already have a purchase for claim_id '{claim_id}'. "
|
|
||||||
f"Use --allow-duplicate-purchase flag to override."
|
|
||||||
)
|
|
||||||
claim = txo.claim
|
claim = txo.claim
|
||||||
if not claim.is_stream or not claim.stream.has_fee:
|
if not claim.is_stream or not claim.stream.has_fee:
|
||||||
# TODO: use error from lbry.error
|
# TODO: use error from lbry.error
|
||||||
|
|
Loading…
Reference in a new issue