Skip to content

Commit 77b70d9

Browse files
committed
address code review issue
1 parent dc38aea commit 77b70d9

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

kaizen/frontend/ui/src/components/EntityExplorer.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@ export default function EntityExplorer() {
3232
method: 'DELETE'
3333
});
3434
if (!res.ok) {
35-
const d = await res.json();
36-
throw new Error(d.detail || 'Failed to delete entity');
35+
let errorMsg = `HTTP ${res.status} ${res.statusText}`;
36+
const body = await res.text();
37+
try {
38+
const d = JSON.parse(body);
39+
errorMsg = d.detail || errorMsg;
40+
} catch {
41+
if (body) errorMsg += `: ${body}`;
42+
}
43+
throw new Error(errorMsg);
3744
}
3845
refetch();
3946
if (selectedEntity?.id === entityId) {

0 commit comments

Comments
 (0)