Skip to content

Commit 6476185

Browse files
committed
Fix after review
1 parent 331f0ed commit 6476185

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/aleph/sdk/client/http.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
)
1919

2020
import aiohttp
21+
from aiohttp.web import HTTPNotFound
2122
from aleph_message import parse_message
2223
from aleph_message.models import AlephMessage, ItemHash, ItemType
2324
from aleph_message.status import MessageStatus
@@ -463,12 +464,6 @@ async def get_program_price(self, item_hash: str) -> PriceResponse:
463464
async def get_message_status(self, item_hash: str) -> MessageStatus:
464465
"""return Status of a message"""
465466
async with self.http_session.get(f"/api/v0/messages/{item_hash}") as resp:
466-
try:
467-
resp.raise_for_status()
468-
except aiohttp.ClientResponseError as e:
469-
if e.status == 404:
470-
raise MessageNotFoundError(f"No such hash {item_hash}")
471-
raise e
472-
473-
message_raw = await resp.json()
474-
return MessageStatus(message_raw["status"])
467+
if resp.status == HTTPNotFound.status_code:
468+
raise MessageNotFoundError(f"No such hash {item_hash}")
469+
resp.raise_for_status()

0 commit comments

Comments
 (0)