one
Version:
One is a React framework for web, iOS, and Android apps.
105 lines (104 loc) • 3.05 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: () => from[key],
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var RouteErrorView_web_exports = {};
__export(RouteErrorView_web_exports, { RouteErrorView: () => RouteErrorView });
module.exports = __toCommonJS(RouteErrorView_web_exports);
var import_jsx_runtime = require("react/jsx-runtime");
const mono = {
color: "white",
fontFamily: "monospace",
margin: 0
};
function RouteErrorView({ routeName, error, errorInfo, onRetry }) {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
style: {
backgroundColor: "#000",
padding: 16
},
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
style: {
display: "flex",
flexDirection: "column",
gap: 16
},
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
style: {
padding: 5,
backgroundColor: "red",
color: "white",
fontSize: 20,
fontFamily: "monospace"
},
children: [
"Error on route \"",
routeName,
"\""
]
}) }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
style: {
...mono,
fontSize: 16,
whiteSpace: "pre-wrap"
},
children: error instanceof Error ? error.message : String(error)
}),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
type: "button",
onClick: onRetry,
style: {
padding: 6,
border: "none",
backgroundColor: "white",
color: "black",
fontSize: 14,
fontFamily: "monospace",
cursor: "pointer"
},
children: "Retry"
}) }),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
style: {
display: "flex",
flexDirection: "column",
gap: 12
},
children: [error instanceof Error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
style: {
...mono,
fontSize: 12,
whiteSpace: "pre-wrap"
},
children: error.stack
}) : null, errorInfo?.componentStack ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("pre", {
style: {
...mono,
fontSize: 12,
whiteSpace: "pre-wrap"
},
children: ["Component Stack: ", errorInfo.componentStack]
}) : null]
})
]
})
});
}