diff --git a/src/app/(tools)/(domain)/_components/domain-not-registered.tsx b/src/app/(tools)/(domain)/_components/domain-not-registered.tsx
index f5c319d..da1c9e6 100644
--- a/src/app/(tools)/(domain)/_components/domain-not-registered.tsx
+++ b/src/app/(tools)/(domain)/_components/domain-not-registered.tsx
@@ -1,8 +1,7 @@
import Image from 'next/image';
import Link from 'next/link';
-import { XCircleIcon } from '@/components/icons/x-circle';
-import { Card } from '@/components/ui/card';
+import { ErrorState } from '@/components/error-state';
import { env } from '@/env';
interface DomainNotRegisteredProps {
@@ -11,47 +10,45 @@ interface DomainNotRegisteredProps {
export function DomainNotRegistered({ domain }: DomainNotRegisteredProps) {
return (
-
-
-
-
- Domain not found
-
-
+
Looks like the domain {domain}{' '}
hasn't been registered yet.
-
- {env.NEXT_PUBLIC_IS_MAIN_INSTANCE === '1' && (
- <>
-
-
-
+ >
+ }
+ >
+ {env.NEXT_PUBLIC_IS_MAIN_INSTANCE === '1' && (
+ <>
+
- >
- )}
-
-
+
+
+ >
+ )}
+
);
}
diff --git a/src/app/(tools)/(domain)/whois/[domain]/page.tsx b/src/app/(tools)/(domain)/whois/[domain]/page.tsx
index a53a8e0..7f7485e 100644
--- a/src/app/(tools)/(domain)/whois/[domain]/page.tsx
+++ b/src/app/(tools)/(domain)/whois/[domain]/page.tsx
@@ -6,6 +6,7 @@ import Link from 'next/link';
import { notFound } from 'next/navigation';
import { Date } from '@/components/date';
+import { ErrorState } from '@/components/error-state';
import { Badge } from '@/components/ui/badge';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Table, TableBody, TableCell, TableRow } from '@/components/ui/table';
@@ -55,14 +56,21 @@ export default async function WhoisLookupResultPage({
const result = await getCachedWhoisLookup(domain);
if (!result.success) {
- if (result.error !== 'domain_not_found') {
- // TODO: Add some kind of component that shows the error code
- notFound();
- }
return (
<>
-
+ {result.error === 'domain_not_found' ? (
+
+ ) : (
+
+ Error code:{' '}
+ {result.error}
+
+ }
+ />
+ )}
>
);
}
diff --git a/src/components/error-state.tsx b/src/components/error-state.tsx
new file mode 100644
index 0000000..8a0ac6f
--- /dev/null
+++ b/src/components/error-state.tsx
@@ -0,0 +1,28 @@
+import type { PropsWithChildren } from 'react';
+
+import { XCircleIcon } from './icons/x-circle';
+import { Card } from './ui/card';
+
+interface ErrorStateProps extends PropsWithChildren {
+ title?: string;
+ description: JSX.Element;
+}
+
+export function ErrorState({
+ title = 'An unexpected error occurred.',
+ description,
+ children
+}: ErrorStateProps) {
+ return (
+
+
+
+
+ {title}
+
+
{description}
+ {children}
+
+
+ );
+}