Files
2022-12-27 12:05:56 +01:00

18 lines
697 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.formatServerError = formatServerError;
function formatServerError(error) {
if (error.message.includes("createContext is not a function")) {
const message = 'createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component';
error.message = message;
if (error.stack) {
const lines = error.stack.split("\n");
lines[0] = message;
error.stack = lines.join("\n");
}
}
}
//# sourceMappingURL=format-server-error.js.map