Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 11x 11x 3x 3x 11x 2x 3x 2x 9x 4x 2x 2x 5x | export function handleApiError(error) {
let responseData = error.response?.data;
if (responseData?.detail && typeof responseData.detail === 'string' && responseData.detail.startsWith('crawler error:')) {
try {
responseData = JSON.parse(responseData.detail.replace('crawler error: ', ''));
} catch (e) {
// Keep original
}
}
if (responseData?.type === 'validation_error' && responseData?.errors) {
const errorMessages = responseData.errors.map(err =>
err.message || `Champ: ${err.field}`
).join('\n');
return errorMessages;
}
if (responseData?.detail) {
if (typeof responseData.detail === 'string') {
return responseData.detail;
}
return responseData.detail.message || responseData.detail.error || 'Erreur';
}
return responseData?.message || 'Erreur de sauvegarde';
}
|