Skip to content

Commit 11c71ed

Browse files
author
Lasim
committed
feat(backend): add error handling schemas for validation and internal server errors
1 parent a65d849 commit 11c71ed

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

services/backend/src/routes/cloud-credentials/schemas.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@ export const searchCredentialsSchema = {
337337
data: z.array(SearchCredentialsResponseSchema).describe('Array of matching credentials (metadata only, no secret values)')
338338
}).describe('Search completed successfully'), {
339339
}),
340+
400: createSchema(z.object({
341+
success: z.boolean().default(false).describe('Indicates if the operation was successful (false for errors)'),
342+
error: z.string().describe('Error message'),
343+
details: z.array(z.string()).describe('Validation error details').optional()
344+
}).describe('Bad Request - Validation error'), {
345+
}),
340346
401: createSchema(z.object({
341347
success: z.boolean().default(false).describe('Indicates if the operation was successful (false for errors)'),
342348
error: z.string().describe('Error message')

services/backend/src/routes/gateway/config/list-clients.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export default async function listClients(server: FastifyInstance) {
3636
403: {
3737
...ERROR_RESPONSE_SCHEMA,
3838
description: 'Forbidden - Insufficient permissions'
39+
},
40+
500: {
41+
...ERROR_RESPONSE_SCHEMA,
42+
description: 'Internal Server Error'
3943
}
4044
}
4145
}

services/backend/src/routes/mcp/github/get-repo-info.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ export default async function getRepoInfo(server: FastifyInstance) {
108108
success: { type: 'boolean', default: false },
109109
error: { type: 'string' }
110110
}
111+
},
112+
500: {
113+
type: 'object',
114+
properties: {
115+
success: { type: 'boolean', default: false },
116+
error: { type: 'string' }
117+
}
111118
}
112119
}
113120
}

0 commit comments

Comments
 (0)