Skip to content

Commit ead786b

Browse files
fix(frontend): mostra messaggi errore reali invece di errori generici
1 parent 522c8e8 commit ead786b

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.
1111
- Frontend API calls now include credentials for proper session authentication
1212
- Ollama context size reduced from 8192 to 2048 to match nomic-embed-text model limit
1313
- Centralized logging configuration for consistent pipeline logs visibility
14+
- UI now shows actual error messages instead of generic failure messages
1415

1516
## [1.1.2] - 2025-12-02
1617

frontend/static/app.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ function ragifyApp() {
109109
this.newCollectionName = '';
110110
await this.loadCollections();
111111
} else {
112-
const data = await res.json();
112+
const data = await res.json().catch(() => ({}));
113113
this.showToast(data.detail || 'Failed to create collection', 'error');
114114
}
115115
} catch (e) {
116-
this.showToast('Failed to create collection', 'error');
116+
this.showToast(`Failed to create collection: ${e.message || 'Network error'}`, 'error');
117117
}
118118
},
119119

@@ -126,10 +126,11 @@ function ragifyApp() {
126126
this.showToast('Collection deleted', 'success');
127127
await this.loadCollections();
128128
} else {
129-
this.showToast('Failed to delete collection', 'error');
129+
const data = await res.json().catch(() => ({}));
130+
this.showToast(data.detail || 'Failed to delete collection', 'error');
130131
}
131132
} catch (e) {
132-
this.showToast('Failed to delete collection', 'error');
133+
this.showToast(`Failed to delete collection: ${e.message || 'Network error'}`, 'error');
133134
}
134135
},
135136

@@ -195,12 +196,14 @@ function ragifyApp() {
195196
});
196197

197198
if (res.ok) {
198-
this.showToast(`Uploaded: ${file.name}`, 'success');
199+
const data = await res.json();
200+
this.showToast(`Uploaded: ${file.name} (Job: ${data.job_id?.slice(0,8) || 'queued'})`, 'success');
199201
} else {
200-
this.showToast(`Failed: ${file.name}`, 'error');
202+
const error = await res.json().catch(() => ({}));
203+
this.showToast(`Failed: ${file.name} - ${error.detail || res.statusText}`, 'error');
201204
}
202205
} catch (e) {
203-
this.showToast(`Failed: ${file.name}`, 'error');
206+
this.showToast(`Failed: ${file.name} - ${e.message || 'Network error'}`, 'error');
204207
}
205208
}
206209

@@ -235,11 +238,11 @@ function ragifyApp() {
235238
this.showToast('No results found', 'info');
236239
}
237240
} else {
238-
const data = await res.json();
241+
const data = await res.json().catch(() => ({}));
239242
this.showToast(data.detail || 'Search failed', 'error');
240243
}
241244
} catch (e) {
242-
this.showToast('Search failed', 'error');
245+
this.showToast(`Search failed: ${e.message || 'Network error'}`, 'error');
243246
}
244247

245248
this.searching = false;

0 commit comments

Comments
 (0)