@ideal-photography/shared
Version:
Shared MongoDB and utility logic for Ideal Photography PWAs: users, products, services, bookings, orders/cart, galleries, reviews, notifications, campaigns, settings, audit logs, minimart items/orders, and push notification subscriptions.
26 lines (24 loc) • 894 B
JavaScript
import { format } from "date-fns";
export const boundary = ({ errorId, error, componentStack, context }) => {
const { pwaType, url, userId, userEmail, timestamp } = context || {};
return {
title: `Unhandled error in ${pwaType?.toUpperCase?.() || "PWA"}`,
message: error?.message || "Unknown error",
type: "error",
recipients: { roles: ['admin', 'super_admin', 'manager'] },
channels: { inApp: true, email: true },
priority: "high",
emailTemplate: "error-notification",
emailData: {
errorId,
errorMessage: error?.message,
errorStack: error?.stack,
componentStack,
pwaType,
url,
userId,
userEmail,
timestamp: timestamp || format(new Date(), "yyyy-MM-dd HH:mm:ss XXX"),
},
};
};