Remove bare catch-and-rethrow blocks in bitbucket and kubernetes plugins

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-04-13 00:35:42 +02:00
parent 774e641e45
commit ed6b53cf83
4 changed files with 18 additions and 25 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/plugin-scaffolder-backend-module-bitbucket-server': patch
'@backstage/plugin-scaffolder-backend-module-bitbucket-cloud': patch
'@backstage/plugin-kubernetes-backend': patch
---
Removed bare catch-and-rethrow blocks that served no purpose.
@@ -49,13 +49,9 @@ class CombinedClustersSupplier implements KubernetesClustersSupplier {
}): Promise<ClusterDetails[]> {
const clusters = await Promise.all(
this.clusterSuppliers.map(supplier => supplier.getClusters(options)),
)
.then(res => {
return res.flat();
})
.catch(e => {
throw e;
});
).then(res => {
return res.flat();
});
return this.warnDuplicates(clusters);
}
@@ -199,7 +199,6 @@ const getDefaultBranch = async (opts: {
apiBaseUrl: string;
}): Promise<string> => {
const { workspace, repo, authorization, apiBaseUrl } = opts;
let response: Response;
const options: RequestInit = {
method: 'GET',
@@ -209,14 +208,10 @@ const getDefaultBranch = async (opts: {
},
};
try {
response = await fetch(
`${apiBaseUrl}/repositories/${workspace}/${repo}`,
options,
);
} catch (error) {
throw error;
}
const response = await fetch(
`${apiBaseUrl}/repositories/${workspace}/${repo}`,
options,
);
const { mainbranch } = await response.json();
const defaultBranch = mainbranch.name;
@@ -213,7 +213,6 @@ const getDefaultBranch = async (opts: {
apiBaseUrl: string;
}) => {
const { project, repo, authorization, apiBaseUrl } = opts;
let response: Response;
const options: RequestInit = {
method: 'GET',
@@ -223,14 +222,10 @@ const getDefaultBranch = async (opts: {
},
};
try {
response = await fetch(
`${apiBaseUrl}/projects/${project}/repos/${repo}/default-branch`,
options,
);
} catch (error) {
throw error;
}
const response = await fetch(
`${apiBaseUrl}/projects/${project}/repos/${repo}/default-branch`,
options,
);
const { displayId } = await response.json();
const defaultBranch = displayId;