File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 1010
1111from aleph .services .ipfs .common import make_ipfs_client
1212from aleph .services .utils import get_IP
13- from aleph .types .message_status import FileUnavailable
13+ from aleph .types .message_status import FileContentUnavailable , FileUnavailable
1414from aleph .utils import run_in_executor
1515
1616LOGGER = logging .getLogger (__name__ )
@@ -113,8 +113,9 @@ async def get_ipfs_size(
113113 await asyncio .sleep (0.5 )
114114 continue
115115 except asyncio .TimeoutError :
116- result = None
117- await asyncio .sleep (0.5 )
116+ raise FileContentUnavailable (
117+ "Could not retrieve IPFS content at this time"
118+ )
118119 except (
119120 concurrent .futures .CancelledError ,
120121 aiohttp .client_exceptions .ClientConnectorError ,
Original file line number Diff line number Diff line change @@ -169,6 +169,16 @@ def __init__(self, file_hash: str):
169169 super ().__init__ (f"File not found: { file_hash } " )
170170
171171
172+ class FileContentNotFoundException (RetryMessageException ):
173+ """
174+ A file required to process the message could not be found, locally and/or
175+ on the network.
176+ """
177+
178+ def __init__ (self , file_hash : str ):
179+ super ().__init__ (f"File content not found: { file_hash } " )
180+
181+
172182class MessageContentUnavailable (FileNotFoundException ):
173183 """
174184 The message content is not available at the moment (storage/IPFS item types).
@@ -185,6 +195,14 @@ class FileUnavailable(FileNotFoundException):
185195 error_code = ErrorCode .FILE_UNAVAILABLE
186196
187197
198+ class FileContentUnavailable (FileContentNotFoundException ):
199+ """
200+ A file pointed to by the message is not available at the moment.
201+ """
202+
203+ error_code = ErrorCode .FILE_UNAVAILABLE
204+
205+
188206class NoAmendTarget (InvalidMessageException ):
189207 """
190208 A POST with type = amend does not specify a value in the ref field.
You can’t perform that action at this time.
0 commit comments