MCPcopy Index your code
hub / github.com/pimutils/vdirsyncer / handle_storage_init_error

Function handle_storage_init_error

vdirsyncer/cli/utils.py:275–303  ·  view source on GitHub ↗
(cls, config)

Source from the content-addressed store, hash-verified

273
274
275def handle_storage_init_error(cls, config):
276 e = sys.exc_info()[1]
277 if not isinstance(e, TypeError) or '__init__' not in repr(e):
278 raise
279
280 all, required = get_storage_init_args(cls)
281 given = set(config)
282 missing = required - given
283 invalid = given - all
284
285 problems = []
286
287 if missing:
288 problems.append(
289 '{} storage requires the parameters: {}'
290 .format(cls.storage_name, ', '.join(missing)))
291
292 if invalid:
293 problems.append(
294 '{} storage doesn\'t take the parameters: {}'
295 .format(cls.storage_name, ', '.join(invalid)))
296
297 if not problems:
298 raise e
299
300 raise exceptions.UserError(
301 'Failed to initialize {}'.format(config['instance_name']),
302 problems=problems
303 )
304
305
306class WorkerQueue:

Callers 2

_discoveredMethod · 0.85

Calls 2

get_storage_init_argsFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected