Skip to content

Commit ebf8433

Browse files
authored
feat: add global error page (#129)
* small changes in agents.md * feat: add global error page
1 parent 55cde55 commit ebf8433

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ describe("Component", () => {
366366
- Loading states
367367
- Accessibility
368368

369+
### Testing Best Practices
370+
371+
- **Prefer `toBeVisible()` over `toBeInTheDocument()`** - `toBeVisible()` checks that an element is actually visible to the user (not hidden via CSS, `aria-hidden`, etc.), while `toBeInTheDocument()` only checks DOM presence. Use `toBeVisible()` for positive assertions and `.not.toBeInTheDocument()` for absence checks.
372+
369373
## Common Mistakes
370374

371375
### 1. Client Components Everywhere

src/app/global-error.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"use client";
2+
3+
import { Inter } from "next/font/google";
4+
import { ToolHiveIcon } from "@/components/icons";
5+
import { Button } from "@/components/ui/button";
6+
import "./globals.css";
7+
8+
const inter = Inter({
9+
variable: "--font-inter",
10+
subsets: ["latin"],
11+
});
12+
13+
interface GlobalErrorProps {
14+
reset: () => void;
15+
}
16+
17+
export default function GlobalError({ reset }: GlobalErrorProps) {
18+
return (
19+
<html lang="en">
20+
<body
21+
className={`${inter.variable} antialiased bg-background text-foreground`}
22+
>
23+
<div className="flex flex-col items-center justify-center min-h-screen gap-6">
24+
<div className="flex items-center gap-2">
25+
<ToolHiveIcon className="size-8 shrink-0" />
26+
<span className="text-3xl font-bold tracking-tight">ToolHive</span>
27+
</div>
28+
29+
<h1 className="text-xl text-muted-foreground">
30+
Something went wrong
31+
</h1>
32+
33+
<Button onClick={reset} variant="default">
34+
Try again
35+
</Button>
36+
</div>
37+
</body>
38+
</html>
39+
);
40+
}

0 commit comments

Comments
 (0)