From 2e03708762203e2b6986420b1d82c62fc65a5ebf Mon Sep 17 00:00:00 2001 From: Gustavo Padovan Date: Wed, 4 Dec 2024 10:29:40 -0300 Subject: [PATCH] config: show a nice error message if not config is available Users will be clueless for a moment if we give them a dump, instead of a clear message. Signed-off-by: Gustavo Padovan --- kcidev/libs/common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kcidev/libs/common.py b/kcidev/libs/common.py index 482dc97..cd97cef 100644 --- a/kcidev/libs/common.py +++ b/kcidev/libs/common.py @@ -3,6 +3,7 @@ import os +import click import toml @@ -26,6 +27,10 @@ def load_toml(settings): config = toml.load(f) if not config: - raise FileNotFoundError("No configuration file found") + click.secho( + f"No `{fname}` configuration file found at `{global_path}`, `{user_path}` or `{settings}`", + fg="red", + ) + raise click.Abort() return config