@getodk/xforms-engine 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -27
- package/dist/index.js.map +1 -1
- package/dist/parse/shared/parseInstanceXML.d.ts +1 -1
- package/dist/solid.js +8 -27
- package/dist/solid.js.map +1 -1
- package/package.json +1 -1
- package/src/error/LoadFormFailureError.ts +9 -35
- package/src/parse/shared/parseInstanceXML.ts +4 -2
package/dist/index.js
CHANGED
|
@@ -424,37 +424,17 @@ const formResourceMetadata = (resource) => {
|
|
|
424
424
|
rawData: null
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
|
-
return
|
|
428
|
-
description: "Raw string data",
|
|
429
|
-
rawData: resource
|
|
430
|
-
};
|
|
427
|
+
return;
|
|
431
428
|
};
|
|
432
429
|
class LoadFormFailureError extends AggregateError {
|
|
433
430
|
constructor(resource, errors) {
|
|
434
|
-
const
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
...errors.map((error) => {
|
|
439
|
-
const aggregatedMessage = error.message;
|
|
440
|
-
if (aggregatedMessage == null) {
|
|
441
|
-
return "- Unknown error";
|
|
442
|
-
}
|
|
443
|
-
return `- ${aggregatedMessage}`;
|
|
444
|
-
})
|
|
445
|
-
];
|
|
446
|
-
if (rawData != null) {
|
|
447
|
-
messageLines.push("\n- - -\n", "Raw resource data:", rawData);
|
|
448
|
-
}
|
|
449
|
-
const message = messageLines.join("\n");
|
|
431
|
+
const metadata = formResourceMetadata(resource);
|
|
432
|
+
const errorMessages = errors.map((error) => error.message || "Unknown error").join("\n");
|
|
433
|
+
const message = metadata?.description ? `Form source: ${metadata.description}
|
|
434
|
+
${errorMessages}` : errorMessages;
|
|
450
435
|
super(errors, message);
|
|
451
436
|
const [head, ...tail] = errors;
|
|
452
|
-
|
|
453
|
-
const { stack } = head;
|
|
454
|
-
if (typeof stack === "string") {
|
|
455
|
-
this.stack = stack;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
437
|
+
this.stack = typeof head?.stack === "string" && !tail.length ? head.stack : "No error trace available.";
|
|
458
438
|
}
|
|
459
439
|
}
|
|
460
440
|
|
|
@@ -27484,7 +27464,8 @@ const getWrappedInstanceRootElement = (xml) => {
|
|
|
27484
27464
|
return root;
|
|
27485
27465
|
};
|
|
27486
27466
|
const parseInstanceXML = (model, instanceXML) => {
|
|
27487
|
-
const
|
|
27467
|
+
const cleanedXML = instanceXML.replace(/<\?xml\s+[^?]*\?>\s*/, "");
|
|
27468
|
+
const wrappedXML = wrapInstanceXML(model, cleanedXML);
|
|
27488
27469
|
const root = getWrappedInstanceRootElement(wrappedXML);
|
|
27489
27470
|
return parseStaticDocumentFromDOMSubtree(root);
|
|
27490
27471
|
};
|