feat: integrate Sentry for error tracking and enhance user notifications
- Added Sentry integration for error tracking across various components, including error boundaries and user actions. - Updated global error handling to capture exceptions and provide detailed feedback to users. - Enhanced user notifications with toast messages for actions such as credit management, image generation, and canvas exports. - Improved user experience by displaying relevant messages during interactions, ensuring better visibility of system states and errors.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Manrope } from "next/font/google";
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
import "./globals.css";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Providers } from "@/components/providers";
|
||||
import { InitUser } from "@/components/init-user";
|
||||
import { getToken } from "@/lib/auth-server";
|
||||
import { getAuthUser, getToken } from "@/lib/auth-server";
|
||||
|
||||
const manrope = Manrope({ subsets: ["latin"], variable: "--font-sans" });
|
||||
|
||||
@@ -19,6 +20,16 @@ export default async function RootLayout({
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const initialToken = await getToken();
|
||||
const user = await getAuthUser();
|
||||
if (user) {
|
||||
const id = user.userId ?? String(user._id);
|
||||
Sentry.setUser({
|
||||
id,
|
||||
email: user.email ?? undefined,
|
||||
});
|
||||
} else {
|
||||
Sentry.setUser(null);
|
||||
}
|
||||
|
||||
return (
|
||||
<html
|
||||
|
||||
Reference in New Issue
Block a user