Gracefully Broken Pdf Download Today

If the PDF library fails mid‑generation, catch and transform the error.

async function downloadPDF() const response = await fetch('/api/generate-pdf', method: 'POST', body: formData ); const contentType = response.headers.get('content-type'); if (contentType.includes('application/json')) const error = await response.json(); showGracefulFailureDialog(error); return; gracefully broken pdf download

function exportRawData() const formData = collectFormData(); const blob = new Blob([JSON.stringify(formData, null, 2)], type: 'application/json' ); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'report-data.json'; a.click(); URL.revokeObjectURL(url); showToast("Raw data saved – you can retry PDF generation later."); If the PDF library fails mid‑generation, catch and

"success": false, "error": "code": "PDF_GEN_FAILED", "message": "Could not render chart data: time series missing.", "recoverable": true, "suggestedAction": "retry", "userDataPreserved": true If the PDF library fails mid‑generation