diff --git a/.changeset/remove-bare-catch-rethrow.md b/.changeset/remove-bare-catch-rethrow.md new file mode 100644 index 0000000000..d1f75164d0 --- /dev/null +++ b/.changeset/remove-bare-catch-rethrow.md @@ -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. diff --git a/plugins/kubernetes-backend/src/cluster-locator/index.ts b/plugins/kubernetes-backend/src/cluster-locator/index.ts index 8437c81f45..25e1101d21 100644 --- a/plugins/kubernetes-backend/src/cluster-locator/index.ts +++ b/plugins/kubernetes-backend/src/cluster-locator/index.ts @@ -49,13 +49,9 @@ class CombinedClustersSupplier implements KubernetesClustersSupplier { }): Promise { 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); } diff --git a/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/bitbucketCloudPullRequest.ts b/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/bitbucketCloudPullRequest.ts index 01b556e6c2..c620490cf2 100644 --- a/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/bitbucketCloudPullRequest.ts +++ b/plugins/scaffolder-backend-module-bitbucket-cloud/src/actions/bitbucketCloudPullRequest.ts @@ -199,7 +199,6 @@ const getDefaultBranch = async (opts: { apiBaseUrl: string; }): Promise => { 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; diff --git a/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts b/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts index ecafe4434c..9d75f304a4 100644 --- a/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts +++ b/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts @@ -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;