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:
l1 = "!!! ERROR !!!"
l2 = "No KIAUH configuration file found!"
error = textwrap.dedent(
f"""
{COLOR_RED}/=======================================================\\
| {l1:^53} |
| {l2:^53} |
\=======================================================/{RESET_FORMAT}
"""
)[1:]
print(error, end="")
Logger.print_dialog(
DialogType.ERROR,
[
"No KIAUH configuration file found! Please make sure you have at least "
"one of the following configuration files in KIAUH's root directory:",
"● default.kiauh.cfg",
"● kiauh.cfg",
],
end="",
)
kill()

View File

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