Skip to content

Commit

Permalink
Add more info to error boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
liambai committed Oct 31, 2024
1 parent b034723 commit 266703f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions viz/src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, ErrorInfo, ReactNode } from "react";
import { Button } from "./ui/button";

interface Props {
children: ReactNode;
Expand Down Expand Up @@ -29,8 +30,19 @@ class ErrorBoundary extends Component<Props, State> {
return (
this.props.fallback || (
<div className="p-4 rounded-lg bg-red-50 border border-red-200">
<h2 className="text-red-800 font-semibold mb-2">Something went wrong</h2>
<p className="text-red-600">{this.state.error?.message}</p>
<h2 className="text-red-800 font-semibold mb-2">
Oops! Something went wrong... send{" "}
<a className="underline" href="mailto:[email protected]">
Liam
</a>{" "}
or{" "}
<a className="underline" href="mailto:[email protected] ">
Etowah
</a>{" "}
an email?
</h2>
<p className="text-red-600 mb-4">{this.state.error?.message}</p>
<Button onClick={() => (window.location.href = "/")}>Return to Home</Button>
</div>
)
);
Expand Down

0 comments on commit 266703f

Please sign in to comment.