MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / mapOAuthTokenError

Function mapOAuthTokenError

packages/node-sdk/src/oauth-error.ts:25–41  ·  view source on GitHub ↗
(error: unknown, providerName: string)

Source from the content-addressed store, hash-verified

23 * remediation path.
24 */
25export function mapOAuthTokenError(error: unknown, providerName: string): KimiError | undefined {
26 if (error instanceof OAuthUnauthorizedError) {
27 return new KimiError(
28 ErrorCodes.AUTH_LOGIN_REQUIRED,
29 `OAuth provider "${providerName}" requires login before it can be used.`,
30 { cause: error },
31 );
32 }
33 if (error instanceof OAuthConnectionError || error instanceof RetryableRefreshError) {
34 return new KimiError(
35 ErrorCodes.PROVIDER_CONNECTION_ERROR,
36 `OAuth provider "${providerName}" failed to fetch an access token: ${error.message}`,
37 { cause: error },
38 );
39 }
40 return undefined;
41}

Callers 2

buildAuthMethod · 0.90
KimiAuthFacadeClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected