diff --git a/core/infrastructure/plumbing.py b/core/infrastructure/plumbing.py index 07ed29c..a353d98 100644 --- a/core/infrastructure/plumbing.py +++ b/core/infrastructure/plumbing.py @@ -97,21 +97,28 @@ class ThreadPlumbing: if self.ui_caller: self.ui_caller(result) - # Show popup and wait for user choice + # do we need to decide on an action? choice = bool(result.function_choice) - logger.info(f"On the main thread, the choice is {choice}") + # if there's a message or a choice to make: + if result.message or choice: + # Then Show popup and wait for user choice + popup = self.error_implementation( + choice=bool(result.function_choice), + title=f"Error: {result.error_type.value}", + message=result.message, + on_answer=self._on_popup_answer, + passed_result=result, + end_app=False + ) + # framework neutral show method + popup.show() + + # otherwise return it as is: + else: + if self.ui_caller: + self.ui_caller(passed_result) - popup = self.error_implementation( - choice=bool(result.function_choice), - title=f"Error: {result.error_type.value}", - message=result.message, - on_answer=self._on_popup_answer, - passed_result=result, - end_app=False - ) - # framework neutral show method - popup.show() def _on_popup_answer(self, user_choice: bool, passed_result: Result): """User responded to popup"""