fix: recipe errors now show specific cause instead of generic 'connection error'
- PHP generateRecipeStream: wrap entire body in try/catch(\Throwable) to catch any PHP fatal/exception mid-stream and send it as a proper SSE error event - PHP: curl timeout raised 60s→90s; capture curl errno/errmsg on failure - PHP: HTTP error messages now include a human-readable status label (e.g. 'Quota API esaurita (429)', 'Nessuna risposta da Gemini (cURL: ...)') - JS catch block: show err.message alongside error.connection so the actual JS network error (NetworkError, AbortError, etc.) is visible - JS no-recipe+no-error path: show recipes.stream_interrupted instead of generic error.connection - Translation: added recipes.stream_interrupted in it/en/de
This commit is contained in:
+5
-2
@@ -14443,7 +14443,8 @@ async function generateRecipe() {
|
||||
showToast((errorEvent.error || t('recipes.generate_error')) + detail, 'error');
|
||||
}
|
||||
} else {
|
||||
showToast(t('error.connection'), 'error');
|
||||
// Stream closed without recipe or error event — likely a server crash mid-stream
|
||||
showToast(t('recipes.stream_interrupted'), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14451,7 +14452,9 @@ async function generateRecipe() {
|
||||
console.error('Recipe error:', err);
|
||||
document.getElementById('recipe-loading').style.display = 'none';
|
||||
document.getElementById('recipe-ask').style.display = '';
|
||||
showToast(t('error.connection'), 'error');
|
||||
// Show the actual JS error (e.g. NetworkError, AbortError, TypeError)
|
||||
const errMsg = err?.message || String(err);
|
||||
showToast(`${t('error.connection')}: ${errMsg}`, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user