42 lines
2.1 KiB
JavaScript
42 lines
2.1 KiB
JavaScript
|
import { useSSRContext, unref, mergeProps, defineAsyncComponent } from 'vue';
|
||
|
import { ssrRenderComponent } from 'vue/server-renderer';
|
||
|
|
||
|
const _sfc_main = {
|
||
|
__name: "nuxt-error-page",
|
||
|
__ssrInlineRender: true,
|
||
|
props: {
|
||
|
error: Object
|
||
|
},
|
||
|
setup(__props) {
|
||
|
const { error } = __props;
|
||
|
(error.stack || "").split("\n").splice(1).map((line) => {
|
||
|
const text = line.replace("webpack:/", "").replace(".vue", ".js").trim();
|
||
|
return {
|
||
|
text,
|
||
|
internal: line.includes("node_modules") && !line.includes(".cache") || line.includes("internal") || line.includes("new Promise")
|
||
|
};
|
||
|
}).map((i) => `<span class="stack${i.internal ? " internal" : ""}">${i.text}</span>`).join("\n");
|
||
|
const statusCode = Number(error.statusCode || 500);
|
||
|
const is404 = statusCode === 404;
|
||
|
const statusMessage = error.statusMessage ?? (is404 ? "Page Not Found" : "Internal Server Error");
|
||
|
const description = error.message || error.toString();
|
||
|
const stack = void 0;
|
||
|
const _Error404 = /* @__PURE__ */ defineAsyncComponent(() => import('./error-404-86c18c69.mjs').then((r) => r.default || r));
|
||
|
const _Error = /* @__PURE__ */ defineAsyncComponent(() => import('./error-500-0c708bce.mjs').then((r) => r.default || r));
|
||
|
const ErrorTemplate = is404 ? _Error404 : _Error;
|
||
|
return (_ctx, _push, _parent, _attrs) => {
|
||
|
_push(ssrRenderComponent(unref(ErrorTemplate), mergeProps({ statusCode: unref(statusCode), statusMessage: unref(statusMessage), description: unref(description), stack: unref(stack) }, _attrs), null, _parent));
|
||
|
};
|
||
|
}
|
||
|
};
|
||
|
const _sfc_setup = _sfc_main.setup;
|
||
|
_sfc_main.setup = (props, ctx) => {
|
||
|
const ssrContext = useSSRContext();
|
||
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/.pnpm/nuxt@3.4.0_@types+node@18.16.16_eslint@8.38.0_rollup@2.79.1_sass@1.62.1_typescript@4.9.5_vue-tsc@1.2.0/node_modules/nuxt/dist/app/components/nuxt-error-page.vue");
|
||
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
||
|
};
|
||
|
const _sfc_main$1 = _sfc_main;
|
||
|
|
||
|
export { _sfc_main$1 as default };
|
||
|
//# sourceMappingURL=error-component-24ff620e.mjs.map
|