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 <felix.moessbauer@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
27cf5ea897
commit
b21a7e1c3b
@ -186,7 +186,11 @@ class IncludeHandler:
|
|||||||
|
|
||||||
missing_repos = []
|
missing_repos = []
|
||||||
configs = []
|
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):
|
if not isinstance(current_config, Mapping):
|
||||||
raise IncludeException('Configuration file does not contain a '
|
raise IncludeException('Configuration file does not contain a '
|
||||||
'dictionary as base type')
|
'dictionary as base type')
|
||||||
|
Loading…
Reference in New Issue
Block a user