MCPcopy Create free account
hub / github.com/code-forge-io/Remix-Forge / generateErrorBoundary

Function generateErrorBoundary

src/generators/errorBoundary.ts:3–19  ·  view source on GitHub ↗
(config: WorkspaceConfiguration)

Source from the content-addressed store, hash-verified

1import { WorkspaceConfiguration } from "vscode";
2
3export const generateErrorBoundary = (config: WorkspaceConfiguration) => {
4 const customErrorBoundary = config.get("errorBoundary");
5
6 if (customErrorBoundary) {
7 return customErrorBoundary + "\n";
8 }
9
10 return [
11 `export function ErrorBoundary(){`,
12 ` const error = useRouteError();`,
13 ` if (isRouteErrorResponse(error)) {`,
14 ` return <div/>`,
15 ` }`,
16 ` return <div/>`,
17 `}`,
18 ].join("\n");
19};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected