@lodashventure/medusa-media-manager 0.2.12 → 0.2.14

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.
@@ -438,7 +438,20 @@ async function deleteMediaAsset(id, force) {
438
438
  credentials: "include"
439
439
  });
440
440
  if (!res.ok) {
441
- throw new Error("Failed to delete media asset");
441
+ let message = "Failed to delete media asset";
442
+ try {
443
+ const body = await res.json();
444
+ message = (body == null ? void 0 : body.message) ?? (body == null ? void 0 : body.error) ?? message;
445
+ } catch {
446
+ try {
447
+ const text = await res.text();
448
+ if (text) {
449
+ message = text;
450
+ }
451
+ } catch {
452
+ }
453
+ }
454
+ throw new Error(message);
442
455
  }
443
456
  }
444
457
  async function replaceMediaAsset(id, file) {
@@ -437,7 +437,20 @@ async function deleteMediaAsset(id, force) {
437
437
  credentials: "include"
438
438
  });
439
439
  if (!res.ok) {
440
- throw new Error("Failed to delete media asset");
440
+ let message = "Failed to delete media asset";
441
+ try {
442
+ const body = await res.json();
443
+ message = (body == null ? void 0 : body.message) ?? (body == null ? void 0 : body.error) ?? message;
444
+ } catch {
445
+ try {
446
+ const text = await res.text();
447
+ if (text) {
448
+ message = text;
449
+ }
450
+ } catch {
451
+ }
452
+ }
453
+ throw new Error(message);
441
454
  }
442
455
  }
443
456
  async function replaceMediaAsset(id, file) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodashventure/medusa-media-manager",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "Medusa v2 plugin providing a Strapi-inspired media manager with storage adapters, variants, and admin UI",
5
5
  "author": "StandUpCode",
6
6
  "license": "MIT",