Skip to content

Commit 9d57279

Browse files
committed
fix(site): handle containers disabled
1 parent 3ebf2d3 commit 9d57279

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

site/src/api/api.ts

+14-5
Original file line numberDiff line numberDiff line change
@@ -2447,11 +2447,20 @@ class ApiMethods {
24472447
labels?.map((label) => ["label", label]),
24482448
);
24492449

2450-
const res =
2451-
await this.axios.get<TypesGen.WorkspaceAgentListContainersResponse>(
2452-
`/api/v2/workspaceagents/${agentId}/containers?${params.toString()}`,
2453-
);
2454-
return res.data;
2450+
try {
2451+
const res =
2452+
await this.axios.get<TypesGen.WorkspaceAgentListContainersResponse>(
2453+
`/api/v2/workspaceagents/${agentId}/containers?${params.toString()}`,
2454+
);
2455+
return res.data;
2456+
} catch (err) {
2457+
// If the error is a 403, it means that experimental
2458+
// containers are not enabled on the agent.
2459+
if (isAxiosError(err) && err.response?.status === 403) {
2460+
return { containers: [] };
2461+
}
2462+
throw err;
2463+
}
24552464
};
24562465

24572466
getInboxNotifications = async (startingBeforeId?: string) => {

0 commit comments

Comments
 (0)