Farmbot-Web-App/frontend/crash_page.tsx

41 lines
1.5 KiB
TypeScript
Raw Permalink Normal View History

2017-12-15 09:39:05 -07:00
import * as React from "react";
2018-03-19 09:25:42 -06:00
import { get } from "lodash";
2017-12-15 10:38:27 -07:00
import { Page } from "./ui/index";
import { Session } from "./session";
2020-02-15 11:30:23 -07:00
import { ExternalUrl } from "./external_urls";
2017-12-15 09:39:05 -07:00
/** Use currying to pass down `error` object for now. */
export function crashPage(error: object) {
return class CrashPage extends React.Component<{}, {}> {
render() {
const stack = get(error, "stack", "No stack.");
const message = get(error, "message", "No message available.");
2018-03-19 09:25:42 -06:00
window.Rollbar &&
window.Rollbar.error &&
window.Rollbar.error(error);
2017-12-15 11:46:34 -07:00
const msg = JSON.stringify({ message, stack });
2017-12-15 09:39:05 -07:00
2017-12-15 10:38:27 -07:00
return <Page>
2017-12-15 09:39:05 -07:00
<h1> Something went wrong! </h1>
<p>We hit an internal error while rendering this page.</p>
<p>We have been notified of the issue and will investigate a solution shortly.</p>
<hr />
2017-12-15 10:38:27 -07:00
<h2>Resolving the Issue</h2>
<ol>
<li>Perform a "hard refresh" (<strong>CTRL + SHIFT + R</strong> on most machines).</li>
<li><span><a onClick={() => Session.clear()}>Log out by clicking here.</a></span></li>
<li>Send the error information (below) to our developer team via the
2020-02-15 11:30:23 -07:00
<a href={ExternalUrl.softwareForum}>FarmBot software
2017-12-15 09:39:05 -07:00
forum</a>. Including additional information (such as steps leading up
to the error) help us identify solutions more quickly. </li>
2017-12-15 10:38:27 -07:00
</ol>
2017-12-15 09:39:05 -07:00
<hr />
<pre>
<br />
{msg}
</pre>
2017-12-15 10:38:27 -07:00
</Page>;
2017-12-15 09:39:05 -07:00
}
};
}