mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
Add /api/events error codes
400 for invalid event (schema violated) 500 for clickhouse error
This commit is contained in:
parent
3aff8994ae
commit
2f5212a2b1
1 changed files with 11 additions and 5 deletions
|
|
@ -21,16 +21,22 @@ export async function POST(request: NextRequest) {
|
|||
const result = eventSchema.safeParse({ ...payload, id, userId, timestamp });
|
||||
|
||||
if (!result.success) {
|
||||
return NextResponse.json({ success: false, error: result.error.message });
|
||||
return NextResponse.json(
|
||||
{ success: false, error: result.error.message },
|
||||
{ status: 400 },
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
await captureEvent(result.data);
|
||||
} catch (error) {
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Unknown error',
|
||||
});
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Unknown error',
|
||||
},
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json({ success: true, id });
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue