mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-07 21:29:22 +00:00
clear error on bad config
This commit is contained in:
@@ -17,7 +17,7 @@ from dotdrop.profile import Profile
|
|||||||
from dotdrop.action import Action, Transform
|
from dotdrop.action import Action, Transform
|
||||||
from dotdrop.logger import Logger
|
from dotdrop.logger import Logger
|
||||||
from dotdrop.utils import strip_home, debug_list, debug_dict
|
from dotdrop.utils import strip_home, debug_list, debug_dict
|
||||||
from dotdrop.exceptions import UndefinedException
|
from dotdrop.exceptions import UndefinedException, YamlException
|
||||||
|
|
||||||
|
|
||||||
TILD = '~'
|
TILD = '~'
|
||||||
@@ -41,7 +41,10 @@ class CfgAggregator:
|
|||||||
self.debug = debug
|
self.debug = debug
|
||||||
self.dry = dry
|
self.dry = dry
|
||||||
self.log = Logger(debug=self.debug)
|
self.log = Logger(debug=self.debug)
|
||||||
self._load()
|
try:
|
||||||
|
self._load()
|
||||||
|
except Exception as exc:
|
||||||
|
raise YamlException(exc) from exc
|
||||||
self._validate()
|
self._validate()
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import os
|
|||||||
from dotdrop.cfg_yaml import CfgYaml as Cfg
|
from dotdrop.cfg_yaml import CfgYaml as Cfg
|
||||||
from dotdrop.options import Options
|
from dotdrop.options import Options
|
||||||
from dotdrop.linktypes import LinkTypes
|
from dotdrop.linktypes import LinkTypes
|
||||||
|
from dotdrop.exceptions import YamlException
|
||||||
from tests.helpers import (SubsetTestCase, _fake_args, clean,
|
from tests.helpers import (SubsetTestCase, _fake_args, clean,
|
||||||
create_fake_config, create_yaml_keyval, get_tempdir,
|
create_fake_config, create_yaml_keyval, get_tempdir,
|
||||||
populate_fake_config, yaml_load, yaml_dump)
|
populate_fake_config, yaml_load, yaml_dump)
|
||||||
@@ -129,7 +130,7 @@ profiles:
|
|||||||
args['--cfg'] = 'mocked'
|
args['--cfg'] = 'mocked'
|
||||||
args['--verbose'] = True
|
args['--verbose'] = True
|
||||||
|
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(YamlException):
|
||||||
o = Options(args=args)
|
o = Options(args=args)
|
||||||
print(o.import_link)
|
print(o.import_link)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user