Skip to content

Commit e6f7d00

Browse files
committed
fix(site): simplify error details and remove SHOW_ERROR_DETAILS flag
- Remove SHOW_ERROR_DETAILS and PUBLIC_VERCEL_ENV constants; always show error details when present - Remove hasErrorDetails variable; inline the check directly - Simplify pre content rendering: remove complex ternary, use straightforward JSX expressions per reviewer suggestion
1 parent 52cec4f commit e6f7d00

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

apps/site/app/[locale]/error.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { useTranslations } from 'next-intl';
44

55
import Button from '#site/components/Common/Button';
66
import GlowingBackdropLayout from '#site/layouts/GlowingBackdrop';
7-
import { SHOW_ERROR_DETAILS } from '#site/next.constants.mjs';
87

98
import type { FC } from 'react';
109

@@ -14,7 +13,6 @@ type ErrorPageProps = {
1413

1514
const ErrorPage: FC<ErrorPageProps> = ({ error }) => {
1615
const t = useTranslations();
17-
const hasErrorDetails = Boolean(error.message || error.digest);
1816

1917
return (
2018
<GlowingBackdropLayout kind="default">
@@ -28,17 +26,15 @@ const ErrorPage: FC<ErrorPageProps> = ({ error }) => {
2826
{t('layouts.error.internalServerError.description')}
2927
</p>
3028

31-
{SHOW_ERROR_DETAILS && hasErrorDetails && (
29+
{(error.message || error.digest) && (
3230
<details className="max-w-2xl rounded-lg border border-neutral-300 bg-neutral-950/90 px-4 py-3 text-left text-neutral-50">
3331
<summary className="cursor-pointer font-medium">
3432
{t('layouts.error.details')}
3533
</summary>
3634

3735
<pre className="mt-3 overflow-x-auto font-mono text-xs leading-6 break-words whitespace-pre-wrap">
3836
{error.message}
39-
{error.digest
40-
? `${error.message ? '\n' : ''}digest: ${error.digest}`
41-
: ''}
37+
{error.digest && `digest: ${error.digest}`}
4238
</pre>
4339
</details>
4440
)}

apps/site/next.constants.mjs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@ export const IS_DEV_ENV = process.env.NODE_ENV === 'development';
1414
*/
1515
export const VERCEL_ENV = process.env.VERCEL_ENV || undefined;
1616

17-
/**
18-
* Public-facing Vercel environment, safe to use in client-side code.
19-
*/
20-
export const PUBLIC_VERCEL_ENV =
21-
process.env.NEXT_PUBLIC_VERCEL_ENV || VERCEL_ENV;
22-
23-
/**
24-
* Error details should only be exposed in local development or Vercel preview
25-
* deployments, never in production.
26-
*/
27-
export const SHOW_ERROR_DETAILS = IS_DEV_ENV || PUBLIC_VERCEL_ENV === 'preview';
28-
2917
/**
3018
* This is used for telling Next.js to do a Static Export Build of the Website
3119
*

0 commit comments

Comments
 (0)