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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+4
-9
@@ -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;
|
||||
|
||||
+4
-9
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user