From b21a7e1c3bce708da6778f3fb4dbd4f079862c3a Mon Sep 17 00:00:00 2001 From: Felix Moessbauer Date: Mon, 8 May 2023 10:17:39 +0200 Subject: [PATCH] includes: wrap missing include file exception The common case that an include file cannot be found is now wrapped into a LoadConfigException. By that, the user gets a more meaningful error message on the console (instead of a stacktrace). Signed-off-by: Felix Moessbauer Signed-off-by: Jan Kiszka --- kas/includehandler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kas/includehandler.py b/kas/includehandler.py index a0920b6..4c9601d 100644 --- a/kas/includehandler.py +++ b/kas/includehandler.py @@ -186,7 +186,11 @@ class IncludeHandler: missing_repos = [] configs = [] - current_config = load_config(filename) + try: + current_config = load_config(filename) + except FileNotFoundError: + raise LoadConfigException('Configuration file not found', + filename) if not isinstance(current_config, Mapping): raise IncludeException('Configuration file does not contain a ' 'dictionary as base type')