Add detailed error logging for subtitle validation errors
This commit is contained in:
parent
2a49a7fcdb
commit
a8fcd070dd
1 changed files with 5 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue