MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / toPopupErrorMessage

Function toPopupErrorMessage

packages/core/api/src/handlers/oauth.ts:60–90  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

58 };
59
60const toPopupErrorMessage = (error: unknown): PopupErrorMessage => {
61 const completeError = decodeOAuthCompleteError(error);
62 if (Option.isSome(completeError))
63 return {
64 short: "Could not complete authentication",
65 details: completeError.value.message,
66 };
67
68 const startError = decodeOAuthStartError(error);
69 if (Option.isSome(startError))
70 return {
71 short: "Could not start authentication",
72 details: startError.value.message,
73 };
74
75 const probeError = decodeOAuthProbeError(error);
76 if (Option.isSome(probeError))
77 return {
78 short: "Could not discover authentication endpoint",
79 details: probeError.value.message,
80 };
81
82 const sessionNotFound = decodeOAuthSessionNotFoundError(error);
83 if (Option.isSome(sessionNotFound))
84 return {
85 short: "OAuth session expired or not found",
86 details: `State: ${sessionNotFound.value.state}`,
87 };
88
89 return { short: "Authentication failed" };
90};
91
92export const OAuthHandlers = HttpApiBuilder.group(ExecutorApi, "oauth", (handlers) =>
93 handlers

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected