include blocked/filtered in the error message
This commit is contained in:
parent
4bc2bf79eb
commit
34c5ab2e56
2 changed files with 7 additions and 6 deletions
|
@ -650,7 +650,7 @@ class SecondaryDB:
|
||||||
censoring_channels = {}
|
censoring_channels = {}
|
||||||
censoring_reposts = {}
|
censoring_reposts = {}
|
||||||
|
|
||||||
def _get_censored_error(canonical_url: str, channel_hash: bytes, repost_hash: bytes):
|
def _get_censored_error(censor_type: str, canonical_url: str, channel_hash: bytes, repost_hash: bytes):
|
||||||
channel = censoring_channels.get(channel_hash) or self._fs_get_claim_by_hash(channel_hash)
|
channel = censoring_channels.get(channel_hash) or self._fs_get_claim_by_hash(channel_hash)
|
||||||
censoring_channels[channel_hash] = channel
|
censoring_channels[channel_hash] = channel
|
||||||
claim = censoring_reposts.get(repost_hash) or self._fs_get_claim_by_hash(repost_hash)
|
claim = censoring_reposts.get(repost_hash) or self._fs_get_claim_by_hash(repost_hash)
|
||||||
|
@ -666,7 +666,7 @@ class SecondaryDB:
|
||||||
reason = ''
|
reason = ''
|
||||||
censoring_reasons[(claim.tx_hash, claim.position)] = reason
|
censoring_reasons[(claim.tx_hash, claim.position)] = reason
|
||||||
return ResolveCensoredError(
|
return ResolveCensoredError(
|
||||||
f'lbry://{canonical_url}', censoring_url, channel_hash.hex(), reason, channel
|
censor_type, f'lbry://{canonical_url}', censoring_url, channel_hash.hex(), reason, channel
|
||||||
)
|
)
|
||||||
|
|
||||||
def _prepare_result(touched, claim_txo):
|
def _prepare_result(touched, claim_txo):
|
||||||
|
@ -723,7 +723,7 @@ class SecondaryDB:
|
||||||
if blocker:
|
if blocker:
|
||||||
blocker_channel_hash, blocker_repost_hash = blocker
|
blocker_channel_hash, blocker_repost_hash = blocker
|
||||||
return _get_censored_error(
|
return _get_censored_error(
|
||||||
canonical_url, blocker_channel_hash, blocker_repost_hash
|
'blocked', canonical_url, blocker_channel_hash, blocker_repost_hash
|
||||||
)
|
)
|
||||||
|
|
||||||
if apply_filtering:
|
if apply_filtering:
|
||||||
|
@ -733,7 +733,7 @@ class SecondaryDB:
|
||||||
if filter_info:
|
if filter_info:
|
||||||
filter_channel_hash, filter_repost_hash = filter_info
|
filter_channel_hash, filter_repost_hash = filter_info
|
||||||
return _get_censored_error(
|
return _get_censored_error(
|
||||||
canonical_url, filter_channel_hash, filter_repost_hash
|
'filtered', canonical_url, filter_channel_hash, filter_repost_hash
|
||||||
)
|
)
|
||||||
|
|
||||||
return ResolveResult(
|
return ResolveResult(
|
||||||
|
|
|
@ -265,12 +265,13 @@ class ResolveTimeoutError(WalletError):
|
||||||
|
|
||||||
class ResolveCensoredError(WalletError):
|
class ResolveCensoredError(WalletError):
|
||||||
|
|
||||||
def __init__(self, censored_url: str, censoring_url: str, censor_id: str, reason: str, censor_row: 'ResolveResult'):
|
def __init__(self, censor_type: str, censored_url: str, censoring_url: str, censor_id: str, reason: str,
|
||||||
|
censor_row: 'ResolveResult'):
|
||||||
|
|
||||||
self.url = censored_url
|
self.url = censored_url
|
||||||
self.censor_id = censor_id
|
self.censor_id = censor_id
|
||||||
self.censor_row = censor_row
|
self.censor_row = censor_row
|
||||||
super().__init__(f"Resolve of '{censored_url}' was censored by {censoring_url}'. Reason given: {reason}")
|
super().__init__(f"Resolve of '{censored_url}' was {censor_type} by {censoring_url}'. Reason given: {reason}")
|
||||||
|
|
||||||
|
|
||||||
class KeyFeeAboveMaxAllowedError(WalletError):
|
class KeyFeeAboveMaxAllowedError(WalletError):
|
||||||
|
|
Loading…
Reference in a new issue