From 7b027e9c697b6eccf90cff653ae3bc779be97889 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Sun, 8 Jul 2018 21:04:54 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Improve=20error=20message=20in?= =?UTF-8?q?=20patchmanifest=20verification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ssn/verify/verifyPatchmanifest.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ssn/verify/verifyPatchmanifest.ts b/src/ssn/verify/verifyPatchmanifest.ts index 3bb7cf6..dab27b5 100644 --- a/src/ssn/verify/verifyPatchmanifest.ts +++ b/src/ssn/verify/verifyPatchmanifest.ts @@ -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 - // + // 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) { //