Skip to content

Commit 3b8bacf

Browse files
authored
Catch Harmony difficulty exception (#24)
1 parent 198d734 commit 3b8bacf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/collectors/bitcoin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async def _probe(self) -> results:
2929
results.record_block_height(self.url, chain_info['headers'])
3030
results.record_total_difficulty(self.url, chain_info['difficulty'])
3131
except Exception as exc:
32-
logger.error("Failed probing {} with error: {}".format(strip_url(self.url), exc))
32+
logger.error("Failed probing {} with error: {} of type: {}".format(strip_url(self.url), exc, type(exc)))
3333
results.record_health(self.url, False)
3434

3535
def probe(self):

src/collectors/evm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def probe(self) -> results:
4444
if self.record_difficulty:
4545
results.record_total_difficulty(self.url, self.client.eth.get_block('latest')['totalDifficulty'])
4646
results.record_difficulty(self.url, self.client.eth.get_block('latest')['difficulty'])
47-
except ExtraDataLengthError:
47+
except (ExtraDataLengthError, KeyError):
4848
logger.info("It looks like this is a POA chain, and does not use difficulty anymore. Collector will ignore difficulty metric from this point on.")
4949
self.record_difficulty = False
5050
try:

0 commit comments

Comments
 (0)