Skip to content

Commit 956e5fb

Browse files
committed
Handle errors when fetching external agent credentials in AgentExternal component
1 parent 45ca610 commit 956e5fb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

site/src/modules/resources/AgentExternal.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { API } from "api/api";
2+
import { getErrorMessage } from "api/errors";
23
import type { Workspace, WorkspaceAgent } from "api/typesGenerated";
34
import isChromatic from "chromatic/isChromatic";
45
import { CodeExample } from "components/CodeExample/CodeExample";
6+
import { displayError } from "components/GlobalSnackbar/utils";
57
import { type FC, useEffect, useState } from "react";
68

79
interface AgentExternalProps {
@@ -29,6 +31,8 @@ export const AgentExternal: FC<AgentExternalProps> = ({
2931
API.getWorkspaceAgentCredentials(workspace.id, agent.name).then((res) => {
3032
setExternalAgentToken(res.agent_token);
3133
setCommand(res.command);
34+
}).catch((err) => {
35+
displayError(getErrorMessage(err, "Failed to get external agent credentials"));
3236
});
3337
}
3438
}, [isExternalAgent, agent.status, workspace.id, agent.name]);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy