@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.cjs.js +7 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +7 -1
- package/dist/index.es.js.map +1 -1
- package/dist/types/src/next/api-handler.d.ts.map +1 -1
- package/dist/types/src/utils/isErrorWithMessage.d.ts +6 -0
- package/dist/types/src/utils/isErrorWithMessage.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1002,7 +1002,10 @@ class Document$1 extends NextDocument__default["default"] {
|
|
|
1002
1002
|
});
|
|
1003
1003
|
}
|
|
1004
1004
|
}
|
|
1005
|
-
const version = "0.2.
|
|
1005
|
+
const version = "0.2.7";
|
|
1006
|
+
function isErrorWithMessage(error) {
|
|
1007
|
+
return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
|
|
1008
|
+
}
|
|
1006
1009
|
function MakeswiftApiHandler(apiKey, { appOrigin = "https://app.makeswift.com", getFonts } = {}) {
|
|
1007
1010
|
const cors = Cors__default["default"]({ origin: appOrigin });
|
|
1008
1011
|
const previewModeProxy = httpProxy.createProxyServer();
|
|
@@ -1060,6 +1063,9 @@ Read more here: https://nextjs.org/blog/next-12-2#on-demand-incremental-static-r
|
|
|
1060
1063
|
await revalidate(req.query.path);
|
|
1061
1064
|
return res.json({ revalidated: true });
|
|
1062
1065
|
} catch (error) {
|
|
1066
|
+
if (isErrorWithMessage(error)) {
|
|
1067
|
+
return res.status(500).json({ message: error.message });
|
|
1068
|
+
}
|
|
1063
1069
|
return res.status(500).json({ message: "Error Revalidating" });
|
|
1064
1070
|
}
|
|
1065
1071
|
}
|