Move exception handling to resolver, add test

This commit is contained in:
Matthias
2019-02-20 20:13:23 +01:00
parent 686949b258
commit 4315c157c7
3 changed files with 26 additions and 9 deletions

View File

@@ -22,7 +22,12 @@ class ExchangeResolver(IResolver):
Load the custom class from config parameter
:param config: configuration dictionary or None
"""
self.exchange = self._load_exchange(exchange_name, kwargs={'config': config})
try:
self.exchange = self._load_exchange(exchange_name, kwargs={'config': config})
except ImportError:
logger.info(
f"No {exchange_name} specific subclass found. Using the generic class instead.")
self.exchange = Exchange(config)
def _load_exchange(
self, exchange_name: str, kwargs: dict) -> Exchange: