forked from mirrors/bookwyrm
Log info, not exception, for expected errors
This commit is contained in:
parent
e0ffcddd3c
commit
72d6a4ce52
3 changed files with 10 additions and 10 deletions
|
@ -19,11 +19,11 @@ def download_file(url, destination):
|
|||
with open(destination, "b+w") as outfile:
|
||||
outfile.write(stream.read())
|
||||
except (urllib.error.HTTPError, urllib.error.URLError):
|
||||
logger.error("Failed to download file %s", url)
|
||||
logger.info("Failed to download file %s", url)
|
||||
except OSError:
|
||||
logger.error("Couldn't open font file %s for writing", destination)
|
||||
logger.info("Couldn't open font file %s for writing", destination)
|
||||
except: # pylint: disable=bare-except
|
||||
logger.exception("Unknown error in file download")
|
||||
logger.info("Unknown error in file download")
|
||||
|
||||
|
||||
class BookwyrmConfig(AppConfig):
|
||||
|
|
|
@ -131,7 +131,7 @@ class AbstractConnector(AbstractMinimalConnector):
|
|||
try:
|
||||
work_data = self.get_work_from_edition_data(data)
|
||||
except (KeyError, ConnectorException) as err:
|
||||
logger.exception(err)
|
||||
logger.info(err)
|
||||
work_data = data
|
||||
|
||||
if not work_data or not edition_data:
|
||||
|
@ -270,7 +270,7 @@ def get_data(url, params=None, timeout=10):
|
|||
timeout=timeout,
|
||||
)
|
||||
except RequestException as err:
|
||||
logger.exception(err)
|
||||
logger.info(err)
|
||||
raise ConnectorException(err)
|
||||
|
||||
if not resp.ok:
|
||||
|
@ -278,7 +278,7 @@ def get_data(url, params=None, timeout=10):
|
|||
try:
|
||||
data = resp.json()
|
||||
except ValueError as err:
|
||||
logger.exception(err)
|
||||
logger.info(err)
|
||||
raise ConnectorException(err)
|
||||
|
||||
return data
|
||||
|
@ -296,7 +296,7 @@ def get_image(url, timeout=10):
|
|||
timeout=timeout,
|
||||
)
|
||||
except RequestException as err:
|
||||
logger.exception(err)
|
||||
logger.info(err)
|
||||
return None, None
|
||||
|
||||
if not resp.ok:
|
||||
|
@ -305,7 +305,7 @@ def get_image(url, timeout=10):
|
|||
image_content = ContentFile(resp.content)
|
||||
extension = imghdr.what(None, image_content.read())
|
||||
if not extension:
|
||||
logger.exception("File requested was not an image: %s", url)
|
||||
logger.info("File requested was not an image: %s", url)
|
||||
return None, None
|
||||
|
||||
return image_content, extension
|
||||
|
|
|
@ -39,7 +39,7 @@ def search(query, min_confidence=0.1, return_first=False):
|
|||
try:
|
||||
result_set = connector.isbn_search(isbn)
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
logger.exception(err)
|
||||
logger.info(err)
|
||||
# if this fails, we can still try regular search
|
||||
|
||||
# if no isbn search results, we fallback to generic search
|
||||
|
@ -48,7 +48,7 @@ def search(query, min_confidence=0.1, return_first=False):
|
|||
result_set = connector.search(query, min_confidence=min_confidence)
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
# we don't want *any* error to crash the whole search page
|
||||
logger.exception(err)
|
||||
logger.info(err)
|
||||
continue
|
||||
|
||||
if return_first and result_set:
|
||||
|
|
Loading…
Reference in a new issue