diff --git a/isitdown/notifiers/__init__.py b/isitdown/notifiers/__init__.py index 28ae219..cab2408 100644 --- a/isitdown/notifiers/__init__.py +++ b/isitdown/notifiers/__init__.py @@ -30,7 +30,14 @@ async def error(self, result): self.errors[result.check] += 1 self.states[result.check] = state.ERROR - await self._dispatch_error(result) + try: + await self._dispatch_error(result) + except Exception: + LOG.exception( + "Error while notifying: %s, state: %s", + result.check, + self.states[result.check], + ) async def ok(self, result): if result.check not in self.errors: @@ -41,9 +48,23 @@ async def ok(self, result): if self.states[result.check] == state.ERROR: self.states[result.check] = state.OK self.errors[result.check] = 0 - await self._recover(result) + try: + await self._recover(result) + except Exception: + LOG.exception( + "Error while notifying: %s, state: %s", + result.check, + self.states[result.check], + ) else: - await self._ok(result) + try: + await self._ok(result) + except Exception as e: + LOG.exception( + "Error while notifying: %s, state: %s", + result.check, + self.states[result.check], + ) async def _dispatch_error(self, result):