Spaces:
Sleeping
Sleeping
Claude Code commited on
Commit ·
7119f51
1
Parent(s): 6875591
Claude Code: improve frontend error handling to show HTTP status codes
Browse files- Update fetchDebugHealth() to log response.status and response.statusText
- setDebugStatsError() now displays actual status code instead of "Error"
- Network errors show 'NET', HTTP errors show numeric status
frontend/agent-dashboard.html
CHANGED
|
@@ -860,12 +860,12 @@
|
|
| 860 |
const data = await response.json();
|
| 861 |
updateDebugStats(data);
|
| 862 |
} else {
|
| 863 |
-
console.error('Failed to fetch debug health:', response.statusText);
|
| 864 |
-
setDebugStatsError();
|
| 865 |
}
|
| 866 |
-
} catch (
|
| 867 |
-
console.error('Error fetching debug health:',
|
| 868 |
-
setDebugStatsError();
|
| 869 |
}
|
| 870 |
}
|
| 871 |
|
|
@@ -883,11 +883,11 @@
|
|
| 883 |
}
|
| 884 |
|
| 885 |
// Set error state for debug stats
|
| 886 |
-
function setDebugStatsError() {
|
| 887 |
const uptimeEl = document.getElementById('uptime');
|
| 888 |
const memoryEl = document.getElementById('memory');
|
| 889 |
-
if (uptimeEl) uptimeEl.textContent =
|
| 890 |
-
if (memoryEl) memoryEl.textContent =
|
| 891 |
}
|
| 892 |
</script>
|
| 893 |
</body>
|
|
|
|
| 860 |
const data = await response.json();
|
| 861 |
updateDebugStats(data);
|
| 862 |
} else {
|
| 863 |
+
console.error('Failed to fetch debug health:', response.status, response.statusText);
|
| 864 |
+
setDebugStatsError(response.status);
|
| 865 |
}
|
| 866 |
+
} catch (err) {
|
| 867 |
+
console.error('Error fetching debug health:', err);
|
| 868 |
+
setDebugStatsError('NET');
|
| 869 |
}
|
| 870 |
}
|
| 871 |
|
|
|
|
| 883 |
}
|
| 884 |
|
| 885 |
// Set error state for debug stats
|
| 886 |
+
function setDebugStatsError(statusCode = 'ERR') {
|
| 887 |
const uptimeEl = document.getElementById('uptime');
|
| 888 |
const memoryEl = document.getElementById('memory');
|
| 889 |
+
if (uptimeEl) uptimeEl.textContent = statusCode;
|
| 890 |
+
if (memoryEl) memoryEl.textContent = statusCode;
|
| 891 |
}
|
| 892 |
</script>
|
| 893 |
</body>
|