(cls, config)
| 273 | |
| 274 | |
| 275 | def 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 | |
| 306 | class WorkerQueue: |
no test coverage detected