Merge pull request #17771 from backstage/freben/await

await response errors
This commit is contained in:
Fredrik Adelöw
2023-05-16 10:46:17 +02:00
committed by GitHub
4 changed files with 10 additions and 3 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/plugin-scaffolder-backend-module-confluence-to-markdown': patch
'@backstage/config-loader': patch
'@backstage/plugin-auth-backend': patch
---
Fixed the way that some request errors are thrown
@@ -149,7 +149,7 @@ export class RemoteConfigSource implements ConfigSource {
signal: signal as import('node-fetch').RequestInit['signal'],
});
if (!res.ok) {
throw ResponseError.fromResponse(res);
throw await ResponseError.fromResponse(res);
}
const content = await res.text();
@@ -227,7 +227,7 @@ export class CloudflareAccessAuthProvider implements AuthProviderRouteHandlers {
{ headers },
);
if (!res.ok) {
throw ResponseError.fromResponse(res);
throw await ResponseError.fromResponse(res);
}
const cfIdentity = await res.json();
return cfIdentity as unknown as CloudflareAccessIdentityProfile;
@@ -88,7 +88,7 @@ export const getAndWriteAttachments = async (
},
});
if (!res.ok) {
throw ResponseError.fromResponse(res);
throw await ResponseError.fromResponse(res);
} else if (res.body !== null) {
fs.openSync(`${workspace}/${mkdocsDir}docs/img/${downloadTitle}`, 'w');
const writeStream = fs.createWriteStream(