From d9afd1bbef59abe02cbc9c21446060cf68e8d0d6 Mon Sep 17 00:00:00 2001 From: Anna Bocharova Date: Thu, 19 Oct 2023 12:29:18 +0000 Subject: [PATCH] Ref: moving UI update outta try block. --- octoprint_octorelay/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/octoprint_octorelay/__init__.py b/octoprint_octorelay/__init__.py index 8e1a8b17..f3d16dfe 100755 --- a/octoprint_octorelay/__init__.py +++ b/octoprint_octorelay/__init__.py @@ -136,10 +136,10 @@ def handle_update_command(self, index: str, target: Optional[bool] = None) -> bo raise HandlingException(400) try: state = self.toggle_relay(index, target) # can raise an Exception if relay is disabled - self.update_ui() - return state except Exception as exception: raise HandlingException(404) from exception + self.update_ui() + return state def handle_cancel_task_command(self, subject: str, target: bool, owner: str) -> bool: self._logger.debug(f"Cancelling tasks from {owner} to switch the relay {subject} {'ON' if target else 'OFF'}")