Use catch-all requests exception

This commit is contained in:
Mouse Reeve 2021-06-20 09:23:57 -07:00
parent 95a19a44f8
commit 7a44a9b516

View file

@ -2,11 +2,10 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from dataclasses import asdict, dataclass from dataclasses import asdict, dataclass
import logging import logging
from urllib3.exceptions import RequestError
from django.db import transaction from django.db import transaction
import requests import requests
from requests.exceptions import SSLError from requests.exceptions import RequestException
from bookwyrm import activitypub, models, settings from bookwyrm import activitypub, models, settings
from .connector_manager import load_more_data, ConnectorException from .connector_manager import load_more_data, ConnectorException
@ -237,7 +236,7 @@ def get_data(url, params=None, timeout=10):
}, },
timeout=timeout, timeout=timeout,
) )
except (RequestError, SSLError, requests.ConnectionError, ConnectionError) as err: except RequestException as err:
logger.exception(err) logger.exception(err)
raise ConnectorException() raise ConnectorException()
@ -262,7 +261,7 @@ def get_image(url, timeout=10):
}, },
timeout=timeout, timeout=timeout,
) )
except (RequestError, SSLError) as err: except RequestException as err:
logger.exception(err) logger.exception(err)
return None return None
if not resp.ok: if not resp.ok: