diff --git a/backend/controllers/analysisController.js b/backend/controllers/analysisController.js index 6884794..fbd2bb7 100644 --- a/backend/controllers/analysisController.js +++ b/backend/controllers/analysisController.js @@ -99,7 +99,8 @@ exports.analyzeImage = async (req, res) => { taskFinished = true; finalResult = pollResponse.data; } else if (status === 'error' || status === 'failed') { - throw new Error(`AI Task failed with status: ${status}`); + console.error('Perfect Corp API Task Error Details:', JSON.stringify(pollResponse.data, null, 2)); + throw new Error(`AI Task failed with status: ${status}. Details: ${JSON.stringify(pollResponse.data)}`); } else { console.log(`Polling... (status: ${status}, attempt: ${attempts})`); } @@ -131,6 +132,6 @@ exports.analyzeImage = async (req, res) => { } catch (error) { console.error('Error analyzing image:', error.response ? JSON.stringify(error.response.data) : error.message); - res.status(500).json({ error: 'Failed to analyze image' }); + res.status(500).json({ error: error.message || 'Failed to analyze image' }); } };