diff --git a/.changeset/cold-meals-like.md b/.changeset/cold-meals-like.md new file mode 100644 index 0000000000..7feb978337 --- /dev/null +++ b/.changeset/cold-meals-like.md @@ -0,0 +1,5 @@ +--- +'@backstage/catalog-client': patch +--- + +Fixed `CatalogClient` error responses for `refreshEntity` and `addLocation`. diff --git a/packages/catalog-client/src/CatalogClient.ts b/packages/catalog-client/src/CatalogClient.ts index b3f8df1aa6..e69f6ad434 100644 --- a/packages/catalog-client/src/CatalogClient.ts +++ b/packages/catalog-client/src/CatalogClient.ts @@ -305,7 +305,7 @@ export class CatalogClient implements CatalogApi { ); if (response.status !== 200) { - throw new Error(await response.text()); + throw await ResponseError.fromResponse(response); } } @@ -345,7 +345,7 @@ export class CatalogClient implements CatalogApi { ); if (response.status !== 201) { - throw new Error(await response.text()); + throw await ResponseError.fromResponse(response); } const { location, entities, exists } = await response.json();