🎨 Improve error message in patchmanifest verification

This commit is contained in:
C-3PO 2018-07-08 21:04:54 +02:00
parent 7ee70e8a2b
commit 7b027e9c69
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -133,10 +133,13 @@ export default function verifyPatchmanifest(manifestFile: xmlJs.Element, product
throw new Error('Expected To element.');
}
//TODO: check if From and To are valid relations
//<ExtraDataItem>
//<ExtraData>
const ExtraData = ReleaseUpdatePath.elements[2];
if (ExtraData.type !== 'element' || ExtraData.name !== 'ExtraData' || ExtraData.attributes !== undefined || ExtraData.elements === undefined) {
throw new Error('Expected ExtraData element.');
if (ExtraData.type !== 'element' || ExtraData.name !== 'ExtraData') {
throw new Error(`Expected ExtraData element in patch ${From.elements[0].text}to${To.elements[0].text}.`);
}
if (ExtraData.attributes !== undefined || ExtraData.elements === undefined) {
throw new Error(`Expected ExtraData element with no attributes but some children in patch ${From.elements[0].text}to${To.elements[0].text}.`);
}
for (let j = 0, jl = ExtraData.elements.length; j < jl; j += 1) {
//<ExtraDataItem>