def make_import(csv_data, dry_run): """Make import""" try: converter = ImportConverter(dry_run=dry_run, csv_data=csv_data) converter.import_csv_data() return converter.get_info() except Exception as e: # pylint: disable=broad-except logger.exception("Import failed: %s", e.message) raise BadRequest("Import failed due to server error: %s" % e.message)
def make_import(csv_data, dry_run, ie_job=None): """Make import""" try: converter = ImportConverter(ie_job, dry_run=dry_run, csv_data=csv_data) converter.import_csv_data() return converter.get_info() except Exception as e: # pylint: disable=broad-except logger.exception("Import failed: %s", e.message) if settings.TESTING: raise raise BadRequest("{} {}".format( app_errors.INTERNAL_SERVER_ERROR.format(job_type="Import"), e.message))