Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

fix(web): the crash page shows its error details again (#15778)

Bartosz Majewskic8e67216ef43
diff --git a/packages/web/public/locales/en/translation.json b/packages/web/public/locales/en/translation.json
index aa5839eb1ab..b0090f2a804 100644
--- a/packages/web/public/locales/en/translation.json
+++ b/packages/web/public/locales/en/translation.json
@@ -632,8 +632,6 @@
"An unexpected error occurred and this page could not be displayed. Your data is safe. Please reload the page to continue.": "An unexpected error occurred and this page could not be displayed. Your data is safe. Please reload the page to continue.",
"Reload page": "Reload page",
"Go to home": "Go to home",
- "Hide technical details": "Hide technical details",
- "Show technical details": "Show technical details",
"Search...": "Search...",
"Search pages, flows, tables...": "Search pages, flows, tables...",
"No results found.": "No results found.",
diff --git a/packages/web/src/app/components/global-error-boundary.tsx b/packages/web/src/app/components/global-error-boundary.tsx
index 2c2c8f281a5..aefad848b48 100644
--- a/packages/web/src/app/components/global-error-boundary.tsx
+++ b/packages/web/src/app/components/global-error-boundary.tsx
@@ -1,10 +1,9 @@
import { t } from 'i18next';
-import { AlertTriangle, RefreshCcw } from 'lucide-react';
-import React, { useEffect, useState } from 'react';
+import { AlertTriangle, Check, Copy, RefreshCcw } from 'lucide-react';
+import React, { useEffect, useRef, useState } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { useRouteError } from 'react-router-dom';
-import { CopyButton } from '@/components/custom/clipboard/copy-button';
import { Button } from '@/components/ui/button';
import { errorReporting } from '@/lib/error-reporting';
@@ -18,7 +17,7 @@ function buildDiagnosticsText(
: new Error(String(error ?? 'Unknown error'));
return [
`Message: ${err.message}`,
- `URL: ${window.location.href}`,
+ `URL: ${window.location.origin}${window.location.pathname}`,
`User Agent: ${navigator.userAgent}`,
`Time: ${new Date().toISOString()}`,
'',
@@ -30,6 +29,13 @@ function buildDiagnosticsText(
].join('\n');
}
+function writeToClipboard(text: string): Promise<void> {
+ return (
+ navigator.clipboard?.writeText(text) ??
+ Promise.reject(new Error('clipboard unavailable'))
+ );
+}
+
const ErrorFallbackContent = ({
error,
componentStack,
@@ -37,8 +43,25 @@ const ErrorFallbackContent = ({
error: unknown;
componentStack?: string | null;
}) => {
- const [showDetails, setShowDetails] = useState(false);
+ const [copyState, setCopyState] = useState<CopyState>('idle');
+ const copyResetTimer = useRef<ReturnType<typeof setTimeout>>(undefined);
const isChunkError = errorReporting.isChunkLoadError(error);
+ const diagnostics = buildDiagnosticsText(error, componentStack);
+
+ useEffect(() => () => clearTimeout(copyResetTimer.current), []);
+
+ const flashCopyState = (state: CopyState) => {
+ clearTimeout(copyResetTimer.current);
+ setCopyState(state);
+ copyResetTimer.current = setTimeout(() => setCopyState('idle'), 3000);
+ };
+
+ const detailsLabel =
+ copyState === 'copied'
+ ? t('Copied')
+ : copyState === 'failed'
+ ? t('Failed to copy to clipboard')
+ : t('Technical Details');
return (
<div className="min-h-screen w-full bg-gray-1 flex items-center justify-center p-6">
@@ -74,29 +97,30 @@ const ErrorFallbackContent = ({
</Button>
</div>
- <div className="w-full flex flex-col items-center gap-3">
- <button
- type="button"
- className="text-xs text-gray-11 hover:text-gray-12 transition-colors"
- onClick={() => setShowDetails((prev) => !prev)}
- >
- {showDetails
- ? t('Hide technical details')
- : t('Show technical details')}
- </button>
- {showDetails && (
- <div className="relative w-full text-left">
- <CopyButton
- textToCopy={buildDiagnosticsText(error, componentStack)}
- variant="ghost"
- withoutTooltip
- className="absolute right-2 top-2 size-7 text-gray-11"
- />
- <pre className="max-h-56 overflow-auto rounded-lg border bg-gray-3/40 p-4 pr-12 font-mono text-xs leading-relaxed text-gray-11 whitespace-pre-wrap break-words">
- {buildDiagnosticsText(error, componentStack)}
- </pre>
- </div>
- )}
+ <div className="w-full flex flex-col gap-2 text-left">
+ <div className="flex items-center justify-between">
+ <span className="text-xs text-gray-11">{detailsLabel}</span>
+ <Button
+ variant="ghost"
+ size="icon"
+ aria-label={t('Copy')}
+ className="size-7 text-gray-11"
+ onClick={() => {
+ writeToClipboard(diagnostics)
+ .then(() => flashCopyState('copied'))
+ .catch(() => flashCopyState('failed'));
+ }}
+ >
+ {copyState === 'copied' ? (
+ <Check className="size-4" />
+ ) : (
+ <Copy className="size-4" />
+ )}
+ </Button>
+ </div>
+ <pre className="max-h-56 overflow-auto rounded-lg border bg-gray-3/40 p-4 font-mono text-xs leading-relaxed text-gray-11 whitespace-pre-wrap break-words select-all">
+ {diagnostics}
+ </pre>
</div>
</div>
</div>
@@ -135,3 +159,5 @@ export const RouteErrorBoundary = () => {
}, [error]);
return <ErrorFallbackContent error={error} />;
};
+
+type CopyState = 'idle' | 'copied' | 'failed';