mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Merge pull request #7 from RooCodeInc/jr/events-error-codes
This commit is contained in:
commit
02b7e22729
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