Skip to content

Commit

Permalink
Just catch all exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
YoRyan committed Oct 12, 2019
1 parent c283681 commit bd6db58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions nuxhash/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ class MiningSession(object):

PROFIT_PRIORITY = 1
STOP_PRIORITY = 0
NH_EXCEPTIONS = (ConnectionError, IOError, OSError, nicehash.NicehashException)

def __init__(self, miners, settings, benchmarks, devices):
self._miners = miners
Expand All @@ -253,7 +252,7 @@ def run(self):
try:
payrates = nicehash.simplemultialgo_info(self._settings)
stratums = nicehash.stratums(self._settings)
except MiningSession.NH_EXCEPTIONS as err:
except Exception as err:
logging.warning(f'NiceHash stats: {err}, retrying in 5 seconds')
time.sleep(5)
else:
Expand All @@ -278,7 +277,7 @@ def _switch_algos(self):
# Get profitability information from NiceHash.
try:
ret_payrates = nicehash.simplemultialgo_info(self._settings)
except MiningSession.NH_EXCEPTIONS as err:
except Exception as err:
logging.warning(f'NiceHash stats: {err}')
else:
self._payrates = (ret_payrates, datetime.now())
Expand Down
5 changes: 2 additions & 3 deletions nuxhash/gui/mining.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ class MiningThread(threading.Thread):
PROFIT_PRIORITY = 1
STATUS_PRIORITY = 2
STOP_PRIORITY = 0
NH_EXCEPTIONS = (ConnectionError, IOError, OSError, nicehash.NicehashException)

def __init__(self, devices=[], window=None,
settings=DEFAULT_SETTINGS, benchmarks=EMPTY_BENCHMARKS):
Expand All @@ -322,7 +321,7 @@ def run(self):
try:
payrates = nicehash.simplemultialgo_info(self._settings)
stratums = nicehash.stratums(self._settings)
except MiningThread.NH_EXCEPTIONS as err:
except Exception as err:
logging.warning(f'NiceHash stats: {err}, retrying in 5 seconds')
time.sleep(5)
else:
Expand Down Expand Up @@ -350,7 +349,7 @@ def _switch_algos(self):
# Get profitability information from NiceHash.
try:
ret_payrates = nicehash.simplemultialgo_info(self._settings)
except MiningThread.NH_EXCEPTIONS as err:
except Exception as err:
logging.warning(f'NiceHash stats: {err}')
else:
self._payrates = (ret_payrates, datetime.now())
Expand Down

0 comments on commit bd6db58

Please sign in to comment.