Log errors in conenctor search

This commit is contained in:
Mouse Reeve 2020-12-30 09:14:07 -08:00
parent 21f67c9e28
commit d7db6d50ba
1 changed files with 3 additions and 0 deletions

View File

@ -1,6 +1,7 @@
''' functionality outline for a book data connector ''' ''' functionality outline for a book data connector '''
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from dataclasses import dataclass from dataclasses import dataclass
import logging
from urllib3.exceptions import RequestError from urllib3.exceptions import RequestError
from django.db import transaction from django.db import transaction
@ -11,6 +12,7 @@ from requests.exceptions import SSLError
from bookwyrm import activitypub, models from bookwyrm import activitypub, models
logger = logging.getLogger(__name__)
class ConnectorException(HTTPError): class ConnectorException(HTTPError):
''' when the connector can't do what was asked ''' ''' when the connector can't do what was asked '''
@ -49,6 +51,7 @@ class AbstractMinimalConnector(ABC):
try: try:
data = resp.json() data = resp.json()
except ValueError as e: except ValueError as e:
logger.exception(e)
raise ConnectorException('Unable to parse json response', e) raise ConnectorException('Unable to parse json response', e)
results = [] results = []