Skip to content

Commit b50a4a7

Browse files
magleasosatbai
authored andcommitted
Fix Failing Catch Block (#9385) (#9407)
* Removed call in catch blocks that would always fail, resulting in obfuscating error * Bumped version
1 parent 7fa3862 commit b50a4a7

File tree

25 files changed

+47
-92
lines changed

25 files changed

+47
-92
lines changed

Tasks/DotNetCoreCLIV2/pushcommand.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ export async function run(): Promise<void> {
1414
try {
1515
packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet);
1616
} catch (error) {
17-
tl.debug('Unable to get packaging URIs, using default collection URI');
17+
tl.debug('Unable to get packaging URIs');
1818
tl.debug(JSON.stringify(error));
19-
const collectionUrl = tl.getVariable('System.TeamFoundationCollectionUri');
20-
packagingLocation = {
21-
PackagingUris: [collectionUrl],
22-
DefaultPackagingUri: collectionUrl
23-
};
19+
throw new Error(error);
2420
}
2521

2622
const buildIdentityDisplayName: string = null;

Tasks/DotNetCoreCLIV2/restorecommand.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ export async function run(): Promise<void> {
1414
try {
1515
packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet);
1616
} catch (error) {
17-
tl.debug('Unable to get packaging URIs, using default collection URI');
17+
tl.debug('Unable to get packaging URIs');
1818
tl.debug(JSON.stringify(error));
19-
const collectionUrl = tl.getVariable('System.TeamFoundationCollectionUri');
20-
packagingLocation = {
21-
PackagingUris: [collectionUrl],
22-
DefaultPackagingUri: collectionUrl
23-
};
19+
throw new Error(error);
2420
}
2521

2622
const buildIdentityDisplayName: string = null;

Tasks/DotNetCoreCLIV2/task.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"demands": [],
1717
"version": {
1818
"Major": 2,
19-
"Minor": 145,
20-
"Patch": 4
19+
"Minor": 146,
20+
"Patch": 0
2121
},
2222
"minimumAgentVersion": "2.115.0",
2323
"instanceNameFormat": "dotnet $(command)",

Tasks/MavenV2/mavenutil.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,9 @@ async function collectFeedRepositories(pomContents:string): Promise<any> {
199199
try {
200200
packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.Maven);
201201
} catch (error) {
202-
tl.debug("Unable to get packaging URIs, using default collection URI");
202+
tl.debug("Unable to get packaging URIs");
203203
tl.debug(JSON.stringify(error));
204-
packagingLocation = {
205-
PackagingUris: [collectionUrl],
206-
DefaultPackagingUri: collectionUrl
207-
};
204+
throw new Error(error);
208205
}
209206

210207
let packageUrl = packagingLocation.DefaultPackagingUri;

Tasks/MavenV2/task.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"author": "Microsoft Corporation",
1717
"version": {
1818
"Major": 2,
19-
"Minor": 143,
20-
"Patch": 3
19+
"Minor": 146,
20+
"Patch": 0
2121
},
2222
"releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`",
2323
"demands": [

Tasks/MavenV3/mavenutil.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,9 @@ async function collectFeedRepositories(pomContents:string): Promise<any> {
199199
try {
200200
packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.Maven);
201201
} catch (error) {
202-
tl.debug("Unable to get packaging URIs, using default collection URI");
202+
tl.debug("Unable to get packaging URIs");
203203
tl.debug(JSON.stringify(error));
204-
packagingLocation = {
205-
PackagingUris: [collectionUrl],
206-
DefaultPackagingUri: collectionUrl};
204+
throw new Error(error);
207205
}
208206

209207
let packageUrl = packagingLocation.DefaultPackagingUri;

Tasks/MavenV3/task.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"author": "Microsoft Corporation",
1717
"version": {
1818
"Major": 3,
19-
"Minor": 143,
20-
"Patch": 3
19+
"Minor": 146,
20+
"Patch": 0
2121
},
2222
"releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`",
2323
"demands": [

Tasks/NpmAuthenticateV0/npmauth.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,9 @@ async function main(): Promise<void> {
7171
try {
7272
packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.Npm);
7373
} catch (error) {
74-
tl.debug('Unable to get packaging URIs, using default collection URI');
74+
tl.debug('Unable to get packaging URIs');
7575
tl.debug(JSON.stringify(error));
76-
const collectionUrl = tl.getVariable('System.TeamFoundationCollectionUri');
77-
packagingLocation = {
78-
PackagingUris: [collectionUrl],
79-
DefaultPackagingUri: collectionUrl
80-
};
76+
throw new Error(error);
8177
}
8278
let LocalNpmRegistries = await npmutil.getLocalNpmRegistries(workingDirectory, packagingLocation.PackagingUris);
8379

Tasks/NpmAuthenticateV0/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"author": "Microsoft Corporation",
99
"version": {
1010
"Major": 0,
11-
"Minor": 145,
11+
"Minor": 146,
1212
"Patch": 0
1313
},
1414
"runsOn": [

Tasks/NpmV0/npmtask.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,9 @@ async function addBuildCredProviderEnv(env: EnvironmentDictionary) : Promise<Env
198198
try {
199199
packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.Npm);
200200
} catch (error) {
201-
tl.debug("Unable to get packaging URIs, using default collection URI");
201+
tl.debug("Unable to get packaging URIs");
202202
tl.debug(JSON.stringify(error));
203-
const collectionUrl = tl.getVariable("System.TeamFoundationCollectionUri");
204-
packagingLocation = {
205-
PackagingUris: [collectionUrl],
206-
DefaultPackagingUri: collectionUrl};
203+
throw new Error(error);
207204
}
208205

209206
var urlPrefixes : string[] = packagingLocation.PackagingUris;

0 commit comments

Comments
 (0)