Files
openclaw/extensions/google-meet/src/google-api-errors.ts
2026-06-04 21:33:54 -04:00

22 lines
714 B
TypeScript

// Google Meet plugin module implements google api errors behavior.
const REAUTH_HINT = "Re-run `openclaw googlemeet auth login` and store the refreshed oauth block.";
function scopeText(scopes: readonly string[]): string {
return scopes.map((scope) => `\`${scope}\``).join(", ");
}
export async function googleApiError(params: {
response: Response;
detail: string;
prefix: string;
scopes?: readonly string[];
}): Promise<Error> {
const scopeHint =
params.scopes && params.scopes.length > 0
? ` Required OAuth scope: ${scopeText(params.scopes)}. ${REAUTH_HINT}`
: "";
return new Error(
`${params.prefix} failed (${params.response.status}): ${params.detail}${scopeHint}`,
);
}