chore: enable verbose error logging on experiment calculations to reveal silent production errors

This commit is contained in:
Christian Vidal Wolf
2026-02-21 21:56:35 +01:00
parent 9259129f95
commit 58cc863748
3 changed files with 23 additions and 10 deletions
+19 -10
View File
@@ -59,18 +59,27 @@ export const updateExperiment = async (
id: string,
updates: Partial<Experiment>
): Promise<Experiment> => {
const response = await fetch(`${API_BASE}?id=${id}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(updates),
});
try {
const response = await fetch(`${API_BASE}?id=${id}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(updates),
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error || 'Failed to update experiment');
if (!response.ok) {
let errText = await response.text();
try {
const errJson = JSON.parse(errText);
errText = errJson.error || errText;
} catch (e) { }
throw new Error(errText);
}
return response.json();
} catch (err: any) {
console.error('API Error in updateExperiment:', err);
throw err;
}
return response.json();
};
export const deleteExperiment = async (id: string): Promise<void> => {