Akmal Dira
Akmal Dira
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Akmal Dira on 8/14/2024 in #questions
Everyone help me, how to handle server component error?
Code:
import { api, HydrateClient } from "@/trpc/server";
import { columns } from "./columns";
import { DataTable } from "./data-table";

export default async function SourcePage() {
const sources = await api.source.getAll();
// Sources will throwing an error (bad request, unauthorized, forbidden, etc)
return (
<HydrateClient>
<div className="">
<h1>Source Page</h1>
<DataTable columns={columns} data={sources} />
</div>
</HydrateClient>
);
}
import { api, HydrateClient } from "@/trpc/server";
import { columns } from "./columns";
import { DataTable } from "./data-table";

export default async function SourcePage() {
const sources = await api.source.getAll();
// Sources will throwing an error (bad request, unauthorized, forbidden, etc)
return (
<HydrateClient>
<div className="">
<h1>Source Page</h1>
<DataTable columns={columns} data={sources} />
</div>
</HydrateClient>
);
}
If i create error.tsx in that route, on production i cant see the original error message
2 replies