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:
dadaloop82
2026-05-23 11:45:26 +00:00
parent 6a41b53174
commit cc0fa09219
5 changed files with 36 additions and 6 deletions
+5 -2
View File
@@ -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');
}
}