diff --git a/libs/importer/src/services/import.service.ts b/libs/importer/src/services/import.service.ts index 8cfe40248c..07e9b998a4 100644 --- a/libs/importer/src/services/import.service.ts +++ b/libs/importer/src/services/import.service.ts @@ -108,7 +108,16 @@ export class ImportService implements ImportServiceAbstraction { fileContents: string, organizationId: string = null ): Promise { - const importResult = await importer.parse(fileContents); + let importResult: ImportResult; + try { + importResult = await importer.parse(fileContents); + } catch (error) { + if (error instanceof SyntaxError) { + throw new Error(this.i18nService.t("importFormatError")); + } + throw error; + } + if (!importResult.success) { if (!Utils.isNullOrWhitespace(importResult.errorMessage)) { throw new Error(importResult.errorMessage);