Fix errors handler
This commit is contained in:
parent
751905d245
commit
c39df3acbf
@ -11,7 +11,6 @@ from abc import abstractmethod
|
|||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from cachetools.ttl import TTLCache
|
from cachetools.ttl import TTLCache
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from functools import cached_property
|
|
||||||
from requests import get
|
from requests import get
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
@ -96,8 +95,8 @@ class BinanceAnnouncement(AnnouncementMixin):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
response = get(url)
|
response = get(url)
|
||||||
except ConnectionResetError:
|
except Exception as e:
|
||||||
raise TemporaryError(f"Binance url ({url}) is not available.")
|
raise TemporaryError(f"Binance url ({url}) is not available. Original Exception: {e}")
|
||||||
|
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
raise TemporaryError(f"Invalid response from url: {url}.\n"
|
raise TemporaryError(f"Invalid response from url: {url}.\n"
|
||||||
@ -142,9 +141,10 @@ class BinanceAnnouncement(AnnouncementMixin):
|
|||||||
self._save_df(df)
|
self._save_df(df)
|
||||||
return df
|
return df
|
||||||
|
|
||||||
except TemporaryError:
|
except TemporaryError as e:
|
||||||
# exception handled, re-raise
|
# exception handled, re-raise
|
||||||
raise
|
logger.error(e)
|
||||||
|
raise e
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# exception not handled raise OperationalException
|
# exception not handled raise OperationalException
|
||||||
|
Loading…
Reference in New Issue
Block a user