nomandiu9 commited on
Commit
afc1774
·
1 Parent(s): 5c735f0

Improve error logging in frontend

Browse files
Files changed (1) hide show
  1. index.html +13 -2
index.html CHANGED
@@ -128,8 +128,19 @@
128
  }
129
 
130
  } catch (error) {
131
- console.error('Error:', error);
132
- showError('Could not connect to the analysis server. Is it running?');
 
 
 
 
 
 
 
 
 
 
 
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
  }