From e35479b080c51f40d5f8bdb775d533b955d9498d Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sun, 22 Feb 2015 14:42:58 +0100 Subject: [PATCH] Skip collections during discovery, don't abort --- vdirsyncer/cli/utils.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/vdirsyncer/cli/utils.py b/vdirsyncer/cli/utils.py index 1a31e66..3d79685 100644 --- a/vdirsyncer/cli/utils.py +++ b/vdirsyncer/cli/utils.py @@ -201,10 +201,10 @@ def _handle_collection_not_found(config, collection, e=None): except NotImplementedError as e: cli_logger.error(e) - raise CliError('Unable to find or create collection "{collection}" for ' - 'storage "{storage}". Please create the collection ' - 'yourself.'.format(collection=collection, - storage=storage_name)) + raise exceptions.CollectionNotFound( + 'Unable to find or create collection "{collection}" for storage ' + '"{storage}". Please create the collection yourself.' + .format(collection=collection, storage=storage_name)) def _collections_for_pair_impl(status_path, name_a, name_b, pair_name, @@ -227,16 +227,20 @@ def _collections_for_pair_impl(status_path, name_a, name_b, pair_name, for collection in collections: try: - a_args = a_discovered[collection] - except KeyError: - a_args = _handle_collection_not_found(config_a, collection) + try: + a_args = a_discovered[collection] + except KeyError: + a_args = _handle_collection_not_found(config_a, collection) - try: - b_args = b_discovered[collection] - except KeyError: - b_args = _handle_collection_not_found(config_b, collection) - - yield collection, (a_args, b_args) + try: + b_args = b_discovered[collection] + except KeyError: + b_args = _handle_collection_not_found(config_b, collection) + except exceptions.CollectionNotFound as e: + cli_logger.warning('Skipping collection {}: {}' + .format(collection, str(e))) + else: + yield collection, (a_args, b_args) def _validate_general_section(general_config):