mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
Display importFormatError on failed to parse input (#5809)
This commit is contained in:
committed by
GitHub
parent
34533f62a9
commit
b734edba14
@@ -108,7 +108,16 @@ export class ImportService implements ImportServiceAbstraction {
|
|||||||
fileContents: string,
|
fileContents: string,
|
||||||
organizationId: string = null
|
organizationId: string = null
|
||||||
): Promise<ImportResult> {
|
): Promise<ImportResult> {
|
||||||
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 (!importResult.success) {
|
||||||
if (!Utils.isNullOrWhitespace(importResult.errorMessage)) {
|
if (!Utils.isNullOrWhitespace(importResult.errorMessage)) {
|
||||||
throw new Error(importResult.errorMessage);
|
throw new Error(importResult.errorMessage);
|
||||||
|
|||||||
Reference in New Issue
Block a user