Skip to content

Commit

Permalink
Merge pull request #89 from aviate-labs/88-ic_apiget_nodes-throws-req…
Browse files Browse the repository at this point in the history
…uestsjsondecodeerror-for-bad-request

add error handling for NodeMonitor.step()
  • Loading branch information
mourginakis authored Oct 9, 2023
2 parents 3ec61bf + aea36c9 commit af00e4c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions node_monitor/node_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,14 @@ def broadcast_status_report(self) -> None:

def step(self) -> None:
"""Iterate NodeMonitor one step."""
self._resync()
self._analyze()
self.broadcast_alerts()
try:
# These all need to be in the same try/catch block, because if
# _resync fails, we don't want to analyze or broadcast_alerts.
self._resync()
self._analyze()
self.broadcast_alerts()
except Exception as e:
print(f"NodeMonitor.step() failed with error: {e}")


def mainloop(self) -> None:
Expand Down

0 comments on commit af00e4c

Please sign in to comment.