refactor: improve error logging on missing kiauh config file

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2024-06-22 10:54:11 +02:00
parent 5eff560627
commit b758b3887b
2 changed files with 18 additions and 15 deletions

View File

@@ -212,15 +212,14 @@ class KiauhSettings:
) )
def _kill(self) -> None: def _kill(self) -> None:
l1 = "!!! ERROR !!!" Logger.print_dialog(
l2 = "No KIAUH configuration file found!" DialogType.ERROR,
error = textwrap.dedent( [
f""" "No KIAUH configuration file found! Please make sure you have at least "
{COLOR_RED}/=======================================================\\ "one of the following configuration files in KIAUH's root directory:",
| {l1:^53} | "● default.kiauh.cfg",
| {l2:^53} | "● kiauh.cfg",
\=======================================================/{RESET_FORMAT} ],
""" end="",
)[1:] )
print(error, end="")
kill() kill()

View File

@@ -120,15 +120,19 @@ class Logger:
@staticmethod @staticmethod
def _format_top_border(color: str) -> str: def _format_top_border(color: str) -> str:
return textwrap.dedent(f""" return textwrap.dedent(
f"""
{color}┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ {color}┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
""")[:-1] """
)[1:-1]
@staticmethod @staticmethod
def _format_bottom_border() -> str: def _format_bottom_border() -> str:
return textwrap.dedent(f""" return textwrap.dedent(
f"""
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
{RESET_FORMAT}""") {RESET_FORMAT}"""
)
@staticmethod @staticmethod
def _format_dialog_title(title: str) -> str: def _format_dialog_title(title: str) -> str: