mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-19 16:21:13 +01:00
print body in OAuth 2 http errors
This commit is contained in:
@@ -53,11 +53,11 @@ export async function getAccessToken(
|
||||
|
||||
const resp = await ctx.httpRequest.send({ httpRequest });
|
||||
|
||||
if (resp.status < 200 || resp.status >= 300) {
|
||||
throw new Error('Failed to fetch access token with status=' + resp.status);
|
||||
}
|
||||
const body = resp.bodyPath ? readFileSync(resp.bodyPath, 'utf8') : '';
|
||||
|
||||
const body = readFileSync(resp.bodyPath ?? '', 'utf8');
|
||||
if (resp.status < 200 || resp.status >= 300) {
|
||||
throw new Error('Failed to fetch access token with status=' + resp.status + ' and body=' + body);
|
||||
}
|
||||
|
||||
let response;
|
||||
try {
|
||||
|
||||
@@ -73,11 +73,11 @@ export async function getOrRefreshAccessToken(ctx: Context, contextId: string, {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (resp.status < 200 || resp.status >= 300) {
|
||||
throw new Error('Failed to fetch access token with status=' + resp.status);
|
||||
}
|
||||
const body = resp.bodyPath ? readFileSync(resp.bodyPath, 'utf8') : '';
|
||||
|
||||
const body = readFileSync(resp.bodyPath ?? '', 'utf8');
|
||||
if (resp.status < 200 || resp.status >= 300) {
|
||||
throw new Error('Failed to refresh access token with status=' + resp.status + ' and body=' + body);
|
||||
}
|
||||
|
||||
let response;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user