Spaces:
Sleeping
Sleeping
Improve error logging in frontend
Browse files- index.html +13 -2
index.html
CHANGED
|
@@ -128,8 +128,19 @@
|
|
| 128 |
}
|
| 129 |
|
| 130 |
} catch (error) {
|
| 131 |
-
console.error('
|
| 132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
} finally {
|
| 134 |
setLoading(false);
|
| 135 |
}
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
} catch (error) {
|
| 131 |
+
console.error('Fetch error:', error);
|
| 132 |
+
|
| 133 |
+
let errorMsg = 'Could not connect to the analysis server.';
|
| 134 |
+
|
| 135 |
+
if (error.message) {
|
| 136 |
+
errorMsg += ' Details: ' + error.message;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
if (window.location.protocol === 'https:' && predictApi.startsWith('http:')) {
|
| 140 |
+
errorMsg += ' (Mixed Content Error: Cannot access HTTP API from HTTPS page)';
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
showError(errorMsg + ' Check console for more info.');
|
| 144 |
} finally {
|
| 145 |
setLoading(false);
|
| 146 |
}
|