File tree Expand file tree Collapse file tree 20 files changed +193
-68
lines changed
Expand file tree Collapse file tree 20 files changed +193
-68
lines changed Original file line number Diff line number Diff 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"
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { MainContent } from '@/components/layout/main-content';
88import { PageHeader } from '@/components/layout/page-header' ;
99import { agentDescription } from '@/constants/page-descriptions' ;
1010import { fetchAgents } from '@/lib/api/agent-full-client' ;
11+ import { getErrorCode } from '@/lib/utils/error-serialization' ;
1112
1213export 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
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { fetchAgents } from '@/lib/api/agent-full-client';
1010import { fetchApiKeys } from '@/lib/api/api-keys' ;
1111import type { Agent } from '@/lib/types/agent-full' ;
1212import { createLookup } from '@/lib/utils' ;
13+ import { getErrorCode } from '@/lib/utils/error-serialization' ;
1314
1415export 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 ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import FullPageError from '@/components/errors/full-page-error';
33import { BodyTemplate } from '@/components/layout/body-template' ;
44import { MainContent } from '@/components/layout/main-content' ;
55import { fetchArtifactComponent } from '@/lib/api/artifact-components' ;
6+ import { getErrorCode } from '@/lib/utils/error-serialization' ;
67
78export 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"
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { PageHeader } from '@/components/layout/page-header';
99import { Button } from '@/components/ui/button' ;
1010import { artifactDescription } from '@/constants/page-descriptions' ;
1111import { fetchArtifactComponents } from '@/lib/api/artifact-components' ;
12+ import { getErrorCode } from '@/lib/utils/error-serialization' ;
1213
1314export 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
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import FullPageError from '@/components/errors/full-page-error';
33import { BodyTemplate } from '@/components/layout/body-template' ;
44import { MainContent } from '@/components/layout/main-content' ;
55import { fetchDataComponent } from '@/lib/api/data-components' ;
6+ import { getErrorCode } from '@/lib/utils/error-serialization' ;
67
78export 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"
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { PageHeader } from '@/components/layout/page-header';
99import { Button } from '@/components/ui/button' ;
1010import { dataComponentDescription } from '@/constants/page-descriptions' ;
1111import { fetchDataComponents } from '@/lib/api/data-components' ;
12+ import { getErrorCode } from '@/lib/utils/error-serialization' ;
1213
1314export 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' } ] } >
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { BodyTemplate } from '@/components/layout/body-template';
77import { MainContent } from '@/components/layout/main-content' ;
88import { type Credential , fetchCredential } from '@/lib/api/credentials' ;
99import { getNangoConnectionMetadata } from '@/lib/mcp-tools/nango' ;
10+ import { getErrorCode } from '@/lib/utils/error-serialization' ;
1011
1112async 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"
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { MainContent } from '@/components/layout/main-content';
99import { PageHeader } from '@/components/layout/page-header' ;
1010import { Button } from '@/components/ui/button' ;
1111import { fetchCredentials } from '@/lib/api/credentials' ;
12+ import { getErrorCode } from '@/lib/utils/error-serialization' ;
1213
1314export 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 (
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { MainContent } from '@/components/layout/main-content';
66import { type Credential , fetchCredentials } from '@/lib/api/credentials' ;
77import { fetchExternalAgent } from '@/lib/api/external-agents' ;
88import type { ExternalAgent } from '@/lib/types/external-agents' ;
9+ import { getErrorCode } from '@/lib/utils/error-serialization' ;
910
1011async 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 }
You can’t perform that action at this time.
0 commit comments