Add detailed error logging for subtitle validation errors

This commit is contained in:
DJP 2025-12-10 22:58:44 -05:00
parent 2a49a7fcdb
commit a8fcd070dd

View file

@ -165,10 +165,14 @@ export default function SubtitlesPage() {
toast.success('Subtitle processing started!');
} catch (err: any) {
console.error('Subtitle processing error:', err);
console.error('Error response:', err.response);
console.error('Error data:', err.response?.data);
// Handle validation errors (array of error objects)
if (err.response?.data?.detail && Array.isArray(err.response.data.detail)) {
const errorMessages = err.response.data.detail.map((e: any) => e.msg || JSON.stringify(e)).join(', ');
const errorMessages = err.response.data.detail.map((e: any) => {
return `${e.loc?.join('.')} - ${e.msg}`;
}).join('; ');
toast.error(`Validation error: ${errorMessages}`);
} else if (typeof err.response?.data?.detail === 'string') {
toast.error(err.response.data.detail);