if mode not in ('insert', 'ensure', 'delete', 'replace'):
        if mode is None:
            raise CommandExecutionError('Mode was not defined. How to process the file?')
        else:
            raise CommandExecutionError('Unknown mode: {0}'.format(mode))