Return early on promise reject.

This commit is contained in:
Dirk Baeumer 2021-03-02 14:55:43 +01:00
parent ed1118b27b
commit 2022aede92
2 changed files with 2 additions and 0 deletions

View file

@ -242,6 +242,7 @@ XLF.parse = function (xlfString) {
}
if (!key) {
reject(new Error(`XLF parsing error: trans-unit ${JSON.stringify(unit, undefined, 0)} defined in file ${originalFilePath} is missing the ID attribute.`));
return;
}
messages[key] = decodeEntities(val);
});

View file

@ -344,6 +344,7 @@ export class XLF {
}
if (!key) {
reject(new Error(`XLF parsing error: trans-unit ${JSON.stringify(unit, undefined, 0)} defined in file ${originalFilePath} is missing the ID attribute.`));
return;
}
messages[key] = decodeEntities(val);
});