diff --git a/frontend/src/shared/state/agentsSlice.ts b/frontend/src/shared/state/agentsSlice.ts index 24574591..a0620436 100644 --- a/frontend/src/shared/state/agentsSlice.ts +++ b/frontend/src/shared/state/agentsSlice.ts @@ -231,6 +231,7 @@ export const launchAgent = createAsyncThunk('agents/launchAgent', async (config: headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(config), }); + if (!res.ok) throw new Error(`Launch failed: ${res.status}`); const data = await res.json(); return data.session as AgentSession; }); diff --git a/frontend/src/shared/state/modesSlice.ts b/frontend/src/shared/state/modesSlice.ts index 3679eb2a..f52aba9a 100644 --- a/frontend/src/shared/state/modesSlice.ts +++ b/frontend/src/shared/state/modesSlice.ts @@ -44,6 +44,7 @@ export const createMode = createAsyncThunk( headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), }); + if (!res.ok) throw new Error(`Create mode failed: ${res.status}`); const data = await res.json(); return data.mode as Mode; } @@ -57,6 +58,7 @@ export const updateMode = createAsyncThunk( headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(updates), }); + if (!res.ok) throw new Error(`Update mode failed: ${res.status}`); const data = await res.json(); return data.mode as Mode; } @@ -66,6 +68,7 @@ export const resetMode = createAsyncThunk( 'modes/reset', async (id: string) => { const res = await fetch(`${MODES_API}/${id}/reset`, { method: 'POST' }); + if (!res.ok) throw new Error(`Reset mode failed: ${res.status}`); const data = await res.json(); return data.mode as Mode; } diff --git a/frontend/src/shared/state/skillsSlice.ts b/frontend/src/shared/state/skillsSlice.ts index 22759c76..8e38ae3b 100644 --- a/frontend/src/shared/state/skillsSlice.ts +++ b/frontend/src/shared/state/skillsSlice.ts @@ -51,6 +51,7 @@ export const createSkill = createAsyncThunk( headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), }); + if (!res.ok) throw new Error(`Create skill failed: ${res.status}`); const data = await res.json(); return data.skill as Skill; } @@ -64,6 +65,7 @@ export const updateSkill = createAsyncThunk( headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(updates), }); + if (!res.ok) throw new Error(`Update skill failed: ${res.status}`); const data = await res.json(); return data.skill as Skill; } diff --git a/frontend/src/shared/state/toolsSlice.ts b/frontend/src/shared/state/toolsSlice.ts index a61ac51e..a564620a 100644 --- a/frontend/src/shared/state/toolsSlice.ts +++ b/frontend/src/shared/state/toolsSlice.ts @@ -66,6 +66,7 @@ export const createTool = createAsyncThunk( headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), }); + if (!res.ok) throw new Error(`Create tool failed: ${res.status}`); const data = await res.json(); return data.tool as ToolDefinition; }