Réorganiser la logique de rendu vidéo pour gérer les erreurs et améliorer la lisibilité du code

This commit is contained in:
2025-02-12 11:26:57 +01:00
parent e61f1e9773
commit ef09fdb1b4

View File

@@ -318,20 +318,19 @@ router.post('/videos/render/:video_id', (req, res) => {
const pathList = measureManager.getPathList(measurementIds, project_id).then(pathList => { const pathList = measureManager.getPathList(measurementIds, project_id).then(pathList => {
console.log('Path list:', pathList); console.log('Path list:', pathList);
res.json({ message: 'Render process started' }); res.json({ message: 'Render process started' });
const videoFile = videoManager.createVideoWithList(project_id, pathList);
console.log('Video file:', videoFile);
try {
videoManager.updateVideoFile(videoId, videoFile);
} catch (err) {
console.error('Error updating video file:', err);
res.status(500).json({ error: 'Error updating video file' });
}
}).catch(err => { }).catch(err => {
console.error('Error getting path list:', err); console.error('Error getting path list:', err);
res.status(500).json({ error: 'Error getting path list' }); res.status(500).json({ error: 'Error getting path list' });
}); });
const videoFile = videoManager.createVideoWithList(project_id, pathList);
console.log('Video file:', videoFile);
try {
videoManager.updateVideoFile(videoId, videoFile);
} catch (err) {
console.error('Error updating video file:', err);
res.status(500).json({ error: 'Error updating video file' });
}
}); });
}); });