Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions src/domains/usfm/usfm.route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import { server } from '@/server/server';

import * as usfmService from './usfm.service';

interface ErrorResponse {
error: string;
details?: string;
}

const projectUnitIdParam = z.object({
projectUnitId: z.coerce.number().int().positive(),
});
Expand Down Expand Up @@ -182,12 +177,11 @@ server.openapi(getExportableBooksRoute, async (c) => {
projectUnitId: c.req.param('projectUnitId'),
});

const errorResponse: ErrorResponse = {
error: 'Failed to get exportable books',
details: errorMessage,
};

return c.json(errorResponse, HttpStatusCodes.INTERNAL_SERVER_ERROR);
// Detail is logged above; do not leak the raw error message to the client.
return c.json(
{ error: 'Failed to get exportable books' },
HttpStatusCodes.INTERNAL_SERVER_ERROR
);
}
});

Expand Down Expand Up @@ -281,13 +275,8 @@ server.openapi(exportProjectUSFMRoute, async (c) => {
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
logger.error('USFM export error', { error: errorMessage, projectUnitId, bookIds });

return c.json(
{
error: 'Failed to export USFM',
details: errorMessage,
},
HttpStatusCodes.INTERNAL_SERVER_ERROR
);
// Detail is logged above; do not leak the raw error message to the client.
return c.json({ error: 'Failed to export USFM' }, HttpStatusCodes.INTERNAL_SERVER_ERROR);
}
});

Expand Down
Loading