Patch from PR #23789

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-03-22 15:22:58 +01:00
parent 7825762f90
commit 9c7fb3003b
14 changed files with 64 additions and 16 deletions
@@ -29,6 +29,7 @@ import {
BackstageCredentials,
DiscoveryService,
} from '@backstage/backend-plugin-api';
import { ResponseError } from '@backstage/errors';
const responseSchema = z.object({
items: z.array(
@@ -90,9 +91,7 @@ export class PermissionIntegrationClient {
});
if (!response.ok) {
throw new Error(
`Unexpected response from plugin upstream when applying conditions. Expected 200 but got ${response.status} - ${response.statusText}`,
);
throw await ResponseError.fromResponse(response);
}
const result = responseSchema.parse(await response.json());