fix: handle error correctly with aiohttp upgrade

This commit is contained in:
2026-03-02 17:41:43 +01:00
parent 4ef3de646e
commit 49ab62bb2c
2 changed files with 18 additions and 3 deletions

View File

@@ -75,6 +75,21 @@ class TestWallabag:
)
assert isinstance(data, dict)
@pytest.mark.asyncio
async def test_get_entries_non_existing_page(self, setup_class):
wallabag, _ = setup_class
data = await wallabag.get_entries(
**{
"delete": 0,
"sort": "created",
"order": "desc",
"page": 10,
"perPage": 30,
"tags": [],
}
)
assert isinstance(data, dict)
@pytest.mark.asyncio
async def test_get_entry(self, setup_class):
wallabag, entry = setup_class

View File

@@ -100,19 +100,19 @@ class Wallabag(object):
json_data = {}
if responses.status != 200:
err_msg = HttpProcessingError(code=responses.status,
message=await responses.json())
message=str(await responses.json()))
logging.error("Wallabag: aiohttp error {err_msg}".format(
err_msg=err_msg))
else:
try:
json_data = responses.json()
json_data = await responses.json()
except ClientResponseError as e:
# sometimes json_data does not return any json() without
# any error. This is due to the grabbing URL which "rejects"
# the URL
logging.error("Wallabag: aiohttp error {code} {message}"
.format(code=e.code, message=e.message))
return await json_data
return json_data
@staticmethod
def __get_attr(what, type_attr, value_attr, **kwargs):