Files
Shortumation/webapp/src/components/SimpleErrorElement.tsx
T
2022-07-15 18:35:25 -04:00

33 lines
658 B
TypeScript

import { FC } from "react";
export const SimpleErrorElement: FC<{ error: Error }> = ({ error }) => {
return (
<div
style={{
padding: "1em",
}}
>
<b>Error Name</b>: {error?.name}
<br />
<b>Error Message</b>
{error?.message}
<br />
<b>Error Stack</b>
<code
style={{
display: "flex",
flexDirection: "column",
padding: "1em",
}}
>
{error?.stack?.split("\n").map((t, i) => (
<span key={i}>{t}</span>
))}
</code>
<br />
<b>JSON:</b>
<code>{JSON.stringify(error)}</code>
</div>
);
};