@forgeax/engine-gltf 0.1.31 → 0.1.33

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.mjs CHANGED
@@ -3695,6 +3695,10 @@ function toAssetPack(doc, existingMeta, source) {
3695
3695
  function isGlbBytes(source) {
3696
3696
  return source.toLowerCase().endsWith(".glb");
3697
3697
  }
3698
+ function parseFailureMessage(prefix, error) {
3699
+ const detail = error.detail === void 0 ? "" : ` detail=${JSON.stringify(error.detail)}`;
3700
+ return `${prefix}: ${error.code} ${error.expected}${detail}`;
3701
+ }
3698
3702
  function publishesCatalogProduct(input) {
3699
3703
  return input.importSettings.geometry !== "procedural";
3700
3704
  }
@@ -3830,7 +3834,7 @@ async function parseDoc(source, bytes, ctx, meshopt) {
3830
3834
  const res2 = await parseGlbForImporter(ab, source, {} );
3831
3835
  if (!res2.ok) {
3832
3836
  if (res2.error instanceof ImportError) return { ok: false, error: res2.error };
3833
- throw new Error(`parseGlb failed: ${res2.error.code} ${res2.error.expected}`);
3837
+ throw new Error(parseFailureMessage("parseGlb failed", res2.error));
3834
3838
  }
3835
3839
  return { ok: true, value: res2.value };
3836
3840
  }
@@ -3858,7 +3862,7 @@ async function parseDoc(source, bytes, ctx, meshopt) {
3858
3862
  );
3859
3863
  if (!res.ok) {
3860
3864
  if (res.error instanceof ImportError) return { ok: false, error: res.error };
3861
- throw new Error(`parseGltf failed: ${res.error.code} ${res.error.expected}`);
3865
+ throw new Error(parseFailureMessage("parseGltf failed", res.error));
3862
3866
  }
3863
3867
  return { ok: true, value: res.value };
3864
3868
  }