mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-21 16:31:18 +02: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 });
|
const resp = await ctx.httpRequest.send({ httpRequest });
|
||||||
|
|
||||||
if (resp.status < 200 || resp.status >= 300) {
|
const body = resp.bodyPath ? readFileSync(resp.bodyPath, 'utf8') : '';
|
||||||
throw new Error('Failed to fetch access token with status=' + resp.status);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
let response;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -73,11 +73,11 @@ export async function getOrRefreshAccessToken(ctx: Context, contextId: string, {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resp.status < 200 || resp.status >= 300) {
|
const body = resp.bodyPath ? readFileSync(resp.bodyPath, 'utf8') : '';
|
||||||
throw new Error('Failed to fetch access token with status=' + resp.status);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
let response;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user