feat: translate API error messages to English
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ export async function GET(request: NextRequest) {
|
||||
|
||||
if (!session?.user) {
|
||||
return NextResponse.json(
|
||||
{ error: 'No autorizado' },
|
||||
{ error: 'Unauthorized' },
|
||||
{ status: 401 }
|
||||
);
|
||||
}
|
||||
@@ -123,7 +123,7 @@ export async function GET(request: NextRequest) {
|
||||
} catch (error) {
|
||||
console.error('Error fetching clients:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Error al obtener los clientes' },
|
||||
{ error: 'Error fetching clients' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
if (!session?.user) {
|
||||
return NextResponse.json(
|
||||
{ error: 'No autorizado' },
|
||||
{ error: 'Unauthorized' },
|
||||
{ status: 401 }
|
||||
);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ export async function POST(request: NextRequest) {
|
||||
if (!validationResult.success) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: 'Datos del cliente inválidos',
|
||||
error: 'Invalid client data',
|
||||
details: validationResult.error.flatten().fieldErrors,
|
||||
},
|
||||
{ status: 400 }
|
||||
@@ -181,7 +181,7 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
if (existingClient) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Ya existe un cliente con este correo electrónico en su organización' },
|
||||
{ error: 'A client with this email already exists in your organization' },
|
||||
{ status: 409 }
|
||||
);
|
||||
}
|
||||
@@ -224,13 +224,13 @@ export async function POST(request: NextRequest) {
|
||||
// Check for unique constraint violation
|
||||
if (error instanceof Error && error.message.includes('Unique constraint')) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Ya existe un cliente con este correo electrónico o DNI' },
|
||||
{ error: 'A client with this email or ID number already exists' },
|
||||
{ status: 409 }
|
||||
);
|
||||
}
|
||||
|
||||
return NextResponse.json(
|
||||
{ error: 'Error al crear el cliente' },
|
||||
{ error: 'Error creating client' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user