/** * @file ErrorBoundary.tsx * @description Catches render errors so the task pane never shows a blank page. */ import * as React from "react"; import { Button, makeStyles, Text, tokens } from "@fluentui/react-components"; import { getErrorMessage } from "../types/office-types"; interface ErrorBoundaryProps { children: React.ReactNode; } interface ErrorBoundaryState { hasError: boolean; message: string; } const useStyles = makeStyles({ root: { display: "flex", flexDirection: "column", alignItems: "flex-start", gap: tokens.spacingVerticalM, padding: tokens.spacingVerticalL, backgroundColor: tokens.colorNeutralBackground1 }, message: { color: tokens.colorNeutralForeground2, whiteSpace: "pre-wrap" } }); const ErrorFallback: React.FC<{ message: string }> = ({ message }) => { const styles = useStyles(); return (