Document exception hierarchy
This commit is contained in:
@@ -29,7 +29,14 @@ class PricingError(DependencyException):
|
||||
"""
|
||||
|
||||
|
||||
class InvalidOrderException(FreqtradeException):
|
||||
class ExchangeError(DependencyException):
|
||||
"""
|
||||
Error raised out of the exchange.
|
||||
Has multiple Errors to determine the appropriate error.
|
||||
"""
|
||||
|
||||
|
||||
class InvalidOrderException(ExchangeError):
|
||||
"""
|
||||
This is returned when the order is not valid. Example:
|
||||
If stoploss on exchange order is hit, then trying to cancel the order
|
||||
@@ -44,13 +51,6 @@ class RetryableOrderError(InvalidOrderException):
|
||||
"""
|
||||
|
||||
|
||||
class ExchangeError(DependencyException):
|
||||
"""
|
||||
Error raised out of the exchange.
|
||||
Has multiple Errors to determine the appropriate error.
|
||||
"""
|
||||
|
||||
|
||||
class TemporaryError(ExchangeError):
|
||||
"""
|
||||
Temporary network or exchange related error.
|
||||
|
@@ -919,7 +919,7 @@ class FreqtradeBot:
|
||||
if not trade.open_order_id:
|
||||
continue
|
||||
order = self.exchange.fetch_order(trade.open_order_id, trade.pair)
|
||||
except (ExchangeError, InvalidOrderException):
|
||||
except (ExchangeError):
|
||||
logger.info('Cannot query order for %s due to %s', trade, traceback.format_exc())
|
||||
continue
|
||||
|
||||
@@ -952,7 +952,7 @@ class FreqtradeBot:
|
||||
for trade in Trade.get_open_order_trades():
|
||||
try:
|
||||
order = self.exchange.fetch_order(trade.open_order_id, trade.pair)
|
||||
except (DependencyException, InvalidOrderException):
|
||||
except (ExchangeError):
|
||||
logger.info('Cannot query order for %s due to %s', trade, traceback.format_exc())
|
||||
continue
|
||||
|
||||
|
@@ -11,7 +11,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
import arrow
|
||||
from numpy import NAN, mean
|
||||
|
||||
from freqtrade.exceptions import (ExchangeError, InvalidOrderException,
|
||||
from freqtrade.exceptions import (ExchangeError,
|
||||
PricingError)
|
||||
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_msecs
|
||||
from freqtrade.misc import shorten_date
|
||||
@@ -555,7 +555,7 @@ class RPC:
|
||||
try:
|
||||
self._freqtrade.exchange.cancel_order(trade.open_order_id, trade.pair)
|
||||
c_count += 1
|
||||
except (ExchangeError, InvalidOrderException):
|
||||
except (ExchangeError):
|
||||
pass
|
||||
|
||||
# cancel stoploss on exchange ...
|
||||
@@ -565,7 +565,7 @@ class RPC:
|
||||
self._freqtrade.exchange.cancel_stoploss_order(trade.stoploss_order_id,
|
||||
trade.pair)
|
||||
c_count += 1
|
||||
except (ExchangeError, InvalidOrderException):
|
||||
except (ExchangeError):
|
||||
pass
|
||||
|
||||
Trade.session.delete(trade)
|
||||
|
Reference in New Issue
Block a user