@makeswift/runtime 0.2.6 → 0.2.7

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.es.js CHANGED
@@ -967,7 +967,10 @@ class Document$1 extends NextDocument {
967
967
  });
968
968
  }
969
969
  }
970
- const version = "0.2.6";
970
+ const version = "0.2.7";
971
+ function isErrorWithMessage(error) {
972
+ return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
973
+ }
971
974
  function MakeswiftApiHandler(apiKey, { appOrigin = "https://app.makeswift.com", getFonts } = {}) {
972
975
  const cors = Cors({ origin: appOrigin });
973
976
  const previewModeProxy = createProxyServer();
@@ -1025,6 +1028,9 @@ Read more here: https://nextjs.org/blog/next-12-2#on-demand-incremental-static-r
1025
1028
  await revalidate(req.query.path);
1026
1029
  return res.json({ revalidated: true });
1027
1030
  } catch (error) {
1031
+ if (isErrorWithMessage(error)) {
1032
+ return res.status(500).json({ message: error.message });
1033
+ }
1028
1034
  return res.status(500).json({ message: "Error Revalidating" });
1029
1035
  }
1030
1036
  }