From f12671fa3f29718b1955e8c5c7a7390eb3dc884e Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Fri, 6 Nov 2020 15:53:20 +0000 Subject: [PATCH] Support tuple-split strings as error messages --- openflexure_microscope/rescue/error_sources.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openflexure_microscope/rescue/error_sources.py b/openflexure_microscope/rescue/error_sources.py index 13cda56f..49f36826 100644 --- a/openflexure_microscope/rescue/error_sources.py +++ b/openflexure_microscope/rescue/error_sources.py @@ -11,7 +11,10 @@ class bcolors: class Source: def __init__(self, message): - self._message = message + if isinstance(message, tuple): + self._message = " ".join(message) + else: + self._message = message @property def message(self): @@ -27,4 +30,4 @@ class WarningSource(Source): class ErrorSource(Source): @property def message(self): - return bcolors.FAIL + self._message + bcolors.ENDC \ No newline at end of file + return bcolors.FAIL + self._message + bcolors.ENDC