Skip to content

Commit 9dd943b

Browse files
authored
Improve client side error messages (#1247)
1 parent e3e20ba commit 9dd943b

File tree

20 files changed

+193
-68
lines changed

20 files changed

+193
-68
lines changed

agents-manage-ui/src/app/[tenantId]/projects/[projectId]/agents/[agentId]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async function AgentPage({
2929
if (!agent.success) {
3030
return (
3131
<FullPageError
32-
error={new Error(agent.error)}
32+
errorCode={agent.code}
3333
context="agent"
3434
link={`/${tenantId}/projects/${projectId}/agents`}
3535
linkText="Back to agents"

agents-manage-ui/src/app/[tenantId]/projects/[projectId]/agents/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { MainContent } from '@/components/layout/main-content';
88
import { PageHeader } from '@/components/layout/page-header';
99
import { agentDescription } from '@/constants/page-descriptions';
1010
import { fetchAgents } from '@/lib/api/agent-full-client';
11+
import { getErrorCode } from '@/lib/utils/error-serialization';
1112

1213
export const dynamic = 'force-dynamic';
1314

@@ -38,7 +39,7 @@ async function AgentsPage({ params }: PageProps<'/[tenantId]/projects/[projectId
3839
</BodyTemplate>
3940
);
4041
} catch (error) {
41-
return <FullPageError error={error as Error} context="agents" />;
42+
return <FullPageError errorCode={getErrorCode(error)} context="agents" />;
4243
}
4344
}
4445

agents-manage-ui/src/app/[tenantId]/projects/[projectId]/api-keys/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { fetchAgents } from '@/lib/api/agent-full-client';
1010
import { fetchApiKeys } from '@/lib/api/api-keys';
1111
import type { Agent } from '@/lib/types/agent-full';
1212
import { createLookup } from '@/lib/utils';
13+
import { getErrorCode } from '@/lib/utils/error-serialization';
1314

1415
export const dynamic = 'force-dynamic';
1516

@@ -32,7 +33,7 @@ async function ApiKeysPage({ params }: PageProps<'/[tenantId]/projects/[projectI
3233
fetchAgents(tenantId, projectId),
3334
]);
3435
} catch (error) {
35-
return <FullPageError error={error as Error} context="API keys" />;
36+
return <FullPageError errorCode={getErrorCode(error)} context="API keys" />;
3637
}
3738

3839
const agentLookup = createLookup(agent.data);

agents-manage-ui/src/app/[tenantId]/projects/[projectId]/artifacts/[artifactComponentId]/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import FullPageError from '@/components/errors/full-page-error';
33
import { BodyTemplate } from '@/components/layout/body-template';
44
import { MainContent } from '@/components/layout/main-content';
55
import { fetchArtifactComponent } from '@/lib/api/artifact-components';
6+
import { getErrorCode } from '@/lib/utils/error-serialization';
67

78
export const dynamic = 'force-dynamic';
89

@@ -44,7 +45,7 @@ export default async function ArtifactComponentPage({
4445
} catch (error) {
4546
return (
4647
<FullPageError
47-
error={error as Error}
48+
errorCode={getErrorCode(error)}
4849
link={`/${tenantId}/projects/${projectId}/artifacts`}
4950
linkText="Back to artifacts"
5051
context="artifact"

agents-manage-ui/src/app/[tenantId]/projects/[projectId]/artifacts/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { PageHeader } from '@/components/layout/page-header';
99
import { Button } from '@/components/ui/button';
1010
import { artifactDescription } from '@/constants/page-descriptions';
1111
import { fetchArtifactComponents } from '@/lib/api/artifact-components';
12+
import { getErrorCode } from '@/lib/utils/error-serialization';
1213

1314
export const dynamic = 'force-dynamic';
1415

@@ -55,7 +56,7 @@ async function ArtifactComponentsPage({
5556
</BodyTemplate>
5657
);
5758
} catch (error) {
58-
return <FullPageError error={error as Error} context="artifacts" />;
59+
return <FullPageError errorCode={getErrorCode(error)} context="artifacts" />;
5960
}
6061
}
6162

agents-manage-ui/src/app/[tenantId]/projects/[projectId]/components/[dataComponentId]/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import FullPageError from '@/components/errors/full-page-error';
33
import { BodyTemplate } from '@/components/layout/body-template';
44
import { MainContent } from '@/components/layout/main-content';
55
import { fetchDataComponent } from '@/lib/api/data-components';
6+
import { getErrorCode } from '@/lib/utils/error-serialization';
67

78
export const dynamic = 'force-dynamic';
89

@@ -17,7 +18,7 @@ export default async function DataComponentPage({
1718
} catch (error) {
1819
return (
1920
<FullPageError
20-
error={error as Error}
21+
errorCode={getErrorCode(error)}
2122
link={`/${tenantId}/projects/${projectId}/components`}
2223
linkText="Back to components"
2324
context="component"

agents-manage-ui/src/app/[tenantId]/projects/[projectId]/components/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { PageHeader } from '@/components/layout/page-header';
99
import { Button } from '@/components/ui/button';
1010
import { dataComponentDescription } from '@/constants/page-descriptions';
1111
import { fetchDataComponents } from '@/lib/api/data-components';
12+
import { getErrorCode } from '@/lib/utils/error-serialization';
1213

1314
export const dynamic = 'force-dynamic';
1415

@@ -21,7 +22,7 @@ async function DataComponentsPage({
2122
try {
2223
dataComponents = await fetchDataComponents(tenantId, projectId);
2324
} catch (error) {
24-
return <FullPageError error={error as Error} context="components" />;
25+
return <FullPageError errorCode={getErrorCode(error)} context="components" />;
2526
}
2627
return (
2728
<BodyTemplate breadcrumbs={[{ label: 'Components' }]}>

agents-manage-ui/src/app/[tenantId]/projects/[projectId]/credentials/[credentialId]/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { BodyTemplate } from '@/components/layout/body-template';
77
import { MainContent } from '@/components/layout/main-content';
88
import { type Credential, fetchCredential } from '@/lib/api/credentials';
99
import { getNangoConnectionMetadata } from '@/lib/mcp-tools/nango';
10+
import { getErrorCode } from '@/lib/utils/error-serialization';
1011

1112
async function credentialToFormData(credential: Credential): Promise<EditCredentialFormData> {
1213
let connectionMetadata: Record<string, string> = {};
@@ -38,7 +39,7 @@ async function EditCredentialsPage({
3839
} catch (error) {
3940
return (
4041
<FullPageError
41-
error={error as Error}
42+
errorCode={getErrorCode(error)}
4243
link={`/${tenantId}/projects/${projectId}/credentials`}
4344
linkText="Back to credentials"
4445
context="credential"

agents-manage-ui/src/app/[tenantId]/projects/[projectId]/credentials/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { MainContent } from '@/components/layout/main-content';
99
import { PageHeader } from '@/components/layout/page-header';
1010
import { Button } from '@/components/ui/button';
1111
import { fetchCredentials } from '@/lib/api/credentials';
12+
import { getErrorCode } from '@/lib/utils/error-serialization';
1213

1314
export const dynamic = 'force-dynamic';
1415

@@ -24,7 +25,7 @@ async function CredentialsPage({
2425
try {
2526
credentials = await fetchCredentials(tenantId, projectId);
2627
} catch (error) {
27-
return <FullPageError error={error as Error} context="credentials" />;
28+
return <FullPageError errorCode={getErrorCode(error)} context="credentials" />;
2829
}
2930

3031
return (

agents-manage-ui/src/app/[tenantId]/projects/[projectId]/external-agents/[externalAgentId]/edit/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { MainContent } from '@/components/layout/main-content';
66
import { type Credential, fetchCredentials } from '@/lib/api/credentials';
77
import { fetchExternalAgent } from '@/lib/api/external-agents';
88
import type { ExternalAgent } from '@/lib/types/external-agents';
9+
import { getErrorCode } from '@/lib/utils/error-serialization';
910

1011
async function EditExternalAgentPage({
1112
params,
@@ -26,10 +27,10 @@ async function EditExternalAgentPage({
2627
console.error('Failed to load external agent:', externalAgentResult.reason);
2728
return (
2829
<FullPageError
29-
error={externalAgentResult.reason as Error}
30+
errorCode={getErrorCode(externalAgentResult.reason)}
3031
link={`/${tenantId}/projects/${projectId}/external-agents`}
3132
linkText="Back to external agents"
32-
context="External agent"
33+
context="external agent"
3334
/>
3435
);
3536
}

0 commit comments

Comments
 (0)