Stephan86 Claude Sonnet 4.6 commited on
Commit
3f769c8
·
1 Parent(s): 6545386

debug: show full error message + absolute URLs

Browse files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. static/index.html +12 -5
static/index.html CHANGED
@@ -342,11 +342,18 @@
342
 
343
  try {
344
  // 1. Upload → reçoit un job_id immédiatement
 
345
  const fd = new FormData(form);
346
- const uploadResp = await fetch('/extract', { method: 'POST', body: fd });
 
 
 
 
 
347
  if (!uploadResp.ok) {
348
- const err = await uploadResp.json();
349
- throw new Error(err.detail || 'Erreur envoi');
 
350
  }
351
  const { job_id } = await uploadResp.json();
352
 
@@ -368,7 +375,7 @@
368
  return;
369
  }
370
  try {
371
- const s = await fetch(`/status/${job_id}`);
372
  const data = await s.json();
373
  if (data.status === 'done') {
374
  clearInterval(poll); clearInterval(ticker);
@@ -384,7 +391,7 @@
384
  progressWrap.classList.remove('visible');
385
 
386
  // 3. Téléchargement du CSV
387
- const dlResp = await fetch(`/download/${job_id}`);
388
  const blob = await dlResp.blob();
389
  const url = URL.createObjectURL(blob);
390
 
 
342
 
343
  try {
344
  // 1. Upload → reçoit un job_id immédiatement
345
+ const base = window.location.origin;
346
  const fd = new FormData(form);
347
+ let uploadResp;
348
+ try {
349
+ uploadResp = await fetch(`${base}/extract`, { method: 'POST', body: fd });
350
+ } catch (netErr) {
351
+ throw new Error(`Réseau upload : ${netErr.message} (${base}/extract)`);
352
+ }
353
  if (!uploadResp.ok) {
354
+ let detail = 'Erreur serveur';
355
+ try { detail = (await uploadResp.json()).detail; } catch(_) {}
356
+ throw new Error(`HTTP ${uploadResp.status} : ${detail}`);
357
  }
358
  const { job_id } = await uploadResp.json();
359
 
 
375
  return;
376
  }
377
  try {
378
+ const s = await fetch(`${base}/status/${job_id}`);
379
  const data = await s.json();
380
  if (data.status === 'done') {
381
  clearInterval(poll); clearInterval(ticker);
 
391
  progressWrap.classList.remove('visible');
392
 
393
  // 3. Téléchargement du CSV
394
+ const dlResp = await fetch(`${base}/download/${job_id}`);
395
  const blob = await dlResp.blob();
396
  const url = URL.createObjectURL(blob);
397