Add error handling to accounts/ledger page

This commit is contained in:
Andymick
2026-07-18 08:54:04 +01:00
parent 3b5d1947dd
commit 2db94f6bd3
+8 -1
View File
@@ -33,7 +33,11 @@ export default async function AccountsPage({
// Include the whole "to" day, not just its midnight.
const to = searchParams.to ? new Date(`${searchParams.to}T23:59:59`) : null;
const [orders, manualSales] = await Promise.all([
let orders = [];
let manualSales = [];
try {
[orders, manualSales] = await Promise.all([
type === 'manual'
? []
: prisma.order.findMany({
@@ -50,6 +54,9 @@ export default async function AccountsPage({
include: { items: true },
}),
]);
} catch (err) {
console.error('Error fetching ledger data:', err);
}
const entries: LedgerEntry[] = [
...orders.map((o) => ({