Local Build and Deploy / deploy (push) Successful in 1m42s
Align onlyBuiltDependencies with the workspace, fail fast without AUTH_SECRET in production, and delete catalog_items via VARCHAR-safe SQL so page deletes do not leave orphans. Co-authored-by: Cursor <[email protected]>
19 lines
604 B
TypeScript
19 lines
604 B
TypeScript
import * as Sentry from "@sentry/nextjs";
|
|
import { logger } from "@/lib/logger";
|
|
|
|
/**
|
|
* Log unexpected errors and forward them to Sentry when a DSN is configured.
|
|
* Domain errors (validation, auth, etc.) should NOT go through here.
|
|
*/
|
|
export function reportError(error: unknown, context = "Unhandled error"): void {
|
|
const message = error instanceof Error ? error.message : String(error);
|
|
logger.error(context, {
|
|
err: message,
|
|
name: error instanceof Error ? error.name : undefined,
|
|
});
|
|
|
|
if (process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN) {
|
|
Sentry.captureException(error);
|
|
}
|
|
}
|