Merge pull request #1191 from bookwyrm-social/getdata-fix

Catch all exceptions from requests when loading remote data
This commit is contained in:
Mouse Reeve 2021-06-20 12:09:14 -07:00 committed by GitHub
commit ae1d0343ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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