You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cvm/src/views/error.jsx

34 lines
733 B
JavaScript

"use strict";
const React = require("react");
const entities = require("entities");
const Layout = require("./layout");
module.exports = {
template: function ErrorPage({ error }) {
let escapedStack = entities.escape(error.stack);
let formattedStack = escapedStack
.split("\n")
.map((line) => {
if (line.includes("node_modules")) {
return `<span class="irrelevant">${line}</span>`;
} else {
return line;
}
})
.join("\n");
return (
<Layout title="An error occurred">
<div className="error">
<h1>An error occurred.</h1>
<h2>{ error.message }</h2>
<div className="stacktrace" dangerouslySetInnerHTML={{ __html: formattedStack }} />
</div>
</Layout>
);
}
};