@cocalc/static
Version:
CoCalc's static frontend Webpack-based build system and framework
32 lines • 2.27 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const url_1 = __importDefault(require("@cocalc/frontend/support/url"));
const link_1 = __importDefault(require("./link"));
function CrashMessage({ msg, lineNo, columnNo, url, stack, showLoadFail, }) {
const getSupport = (0, url_1.default)({
subject: showLoadFail
? "Crash Report: CoCalc Failed to Load"
: "CoCalc Crash Report",
body: `\n\nCONTEXT:\n\n${JSON.stringify({ msg, lineNo, columnNo, stack, url }, undefined, 2)}`,
type: "question",
hideExtra: true,
});
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("strong", { children: "Application Error:" }), " ", (0, jsx_runtime_1.jsxs)("code", { children: [msg, " @ ", lineNo, "/", columnNo, " of ", url] })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
border: "1px solid lightgrey",
margin: "30px 0",
padding: "15px",
background: "white",
borderRadius: "5px",
}, children: [showLoadFail && (0, jsx_runtime_1.jsx)("h3", { children: "CoCalc Failed to Load" }), (0, jsx_runtime_1.jsx)(link_1.default, { href: getSupport, children: (0, jsx_runtime_1.jsx)("b", { children: "Report the full error." }) }), " ", "In the meantime, try switching to another web browser, upating to the latest version of your browser, or", " ", (0, jsx_runtime_1.jsx)("a", { onClick: () => {
const crash = document.getElementById("cocalc-react-crash");
if (crash == null)
return;
crash.style.display = "none";
}, children: "dismissing this error" }), " ", "and continuing."] }), (0, jsx_runtime_1.jsx)("pre", { style: { overflow: "auto", marginTop: "15px", background: "white" }, children: stack })] }));
}
exports.default = CrashMessage;
//# sourceMappingURL=crash-message.js.map