mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-17 00:30:45 +00:00
21 lines
646 B
TypeScript
21 lines
646 B
TypeScript
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}`,
|
|
);
|
|
}
|