From da764f39ad4f29fc23f7c6b81078732e5de1e9b9 Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Wed, 24 Aug 2022 20:53:30 +0200 Subject: [PATCH] catch undefined profile --- dotdrop/dotdrop.py | 3 +++ dotdrop/importer.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/dotdrop/dotdrop.py b/dotdrop/dotdrop.py index bf99e78..f7ba860 100644 --- a/dotdrop/dotdrop.py +++ b/dotdrop/dotdrop.py @@ -851,6 +851,9 @@ def _exec_command(opts): LOG.dbg('running cmd: {}'.format(command)) cmd_remove(opts) + except UndefinedException as exc: + LOG.err(exc) + ret = False except KeyboardInterrupt: LOG.err('interrupted') ret = False diff --git a/dotdrop/importer.py b/dotdrop/importer.py index ecbe2df..528bd43 100644 --- a/dotdrop/importer.py +++ b/dotdrop/importer.py @@ -16,6 +16,7 @@ from dotdrop.utils import strip_home, get_default_file_perms, \ from dotdrop.linktypes import LinkTypes from dotdrop.comparator import Comparator from dotdrop.templategen import Templategen +from dotdrop.exceptions import UndefinedException class Importer: @@ -35,8 +36,11 @@ class Importer: @debug: enable debug @keepdot: keep dot prefix @ignore: patterns to ignore when importing + This may raise UndefinedException """ self.profile = profile + if not self.profile: + raise UndefinedException("profile is undefined") self.conf = conf self.dotpath = dotpath self.diff_cmd = diff_cmd