From 67ad9e93513dea5ab9ed9f729f943debcf05cb85 Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Sat, 24 Feb 2018 19:19:43 +0200 Subject: [PATCH] simplify some error message statements --- freqtrade/exchange/bittrex.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/freqtrade/exchange/bittrex.py b/freqtrade/exchange/bittrex.py index 7d9560a2d..5aa07e460 100644 --- a/freqtrade/exchange/bittrex.py +++ b/freqtrade/exchange/bittrex.py @@ -109,8 +109,7 @@ class Bittrex(Exchange): if not data.get('result') or\ not all(key in data.get('result', {}) for key in keys) or\ not all(data.get('result', {})[key] is not None for key in keys): - raise ContentDecodingError('{message} params=({pair})'.format( - message='Invalid response from Bittrex', + raise ContentDecodingError('Invalid response from Bittrex params=({pair})'.format( pair=pair)) # Update the pair self.cached_ticker[pair] = { @@ -138,16 +137,14 @@ class Bittrex(Exchange): # These sanity check are necessary because bittrex cannot keep their API stable. if not data.get('result'): - raise ContentDecodingError('{message} params=({pair})'.format( - message='Invalid response from Bittrex', + raise ContentDecodingError('Invalid response from Bittrex params=({pair})'.format( pair=pair)) for prop in ['C', 'V', 'O', 'H', 'L', 'T']: for tick in data['result']: if prop not in tick.keys(): - raise ContentDecodingError('{message} params=({pair})'.format( - message='Required property {} not present in response'.format(prop), - pair=pair)) + raise ContentDecodingError('Required property {} not present ' + 'in response params=({})'.format(prop, pair)) if not data['success']: Bittrex._validate_response(data) @@ -191,21 +188,21 @@ class Bittrex(Exchange): data = _API.get_markets() if not data['success']: Bittrex._validate_response(data) - raise OperationalException('{message}'.format(message=data['message'])) + raise OperationalException(data['message']) return [m['MarketName'].replace('-', '_') for m in data['result']] def get_market_summaries(self) -> List[Dict]: data = _API.get_market_summaries() if not data['success']: Bittrex._validate_response(data) - raise OperationalException('{message}'.format(message=data['message'])) + raise OperationalException(data['message']) return data['result'] def get_wallet_health(self) -> List[Dict]: data = _API_V2.get_wallet_health() if not data['success']: Bittrex._validate_response(data) - raise OperationalException('{message}'.format(message=data['message'])) + raise OperationalException(data['message']) return [{ 'Currency': entry['Health']['Currency'], 'IsActive': entry['Health']['IsActive'],