Skip to content

Commit

Permalink
Log more descriptive error message if version option input is invalid…
Browse files Browse the repository at this point in the history
… UPack@0 (#18925)

* Log more descriptive error message if version option input is invalid

* Run build, correct version strings
  • Loading branch information
magleaso authored Sep 11, 2023
1 parent 61960ba commit 6c6ab58
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"loc.messages.PackagesPublishedSuccessfully": "Packages were published successfully",
"loc.messages.PackagesFailedToPublish": "Packages failed to publish",
"loc.messages.UnknownFeedType": "Unknown feed type '%s'",
"loc.messages.Error_NoVersionOptionSpecifiedForPublish": "Invalid versionOption/versionPublishSelector provided. Must be set to 'major', 'minor', 'patch', or 'custom'",
"loc.messages.Error_NoSourceSpecifiedForPublish": "No external source was specified for publish",
"loc.messages.Error_NoSourceSpecifiedForDownload": "No external source was specified for download",
"loc.messages.Error_UnexpectedErrorArtifactTool": "An unexpected error occurred while trying to push the package. Exit code(%s) and error(%s)",
Expand Down
3 changes: 2 additions & 1 deletion Tasks/UniversalPackagesV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"category": "Package",
"version": {
"Major": 0,
"Minor": 227,
"Minor": 228,
"Patch": 0
},
"runsOn": [
Expand Down Expand Up @@ -427,6 +427,7 @@
"PackagesPublishedSuccessfully": "Packages were published successfully",
"PackagesFailedToPublish": "Packages failed to publish",
"UnknownFeedType": "Unknown feed type '%s'",
"Error_NoVersionOptionSpecifiedForPublish": "Invalid versionOption/versionPublishSelector provided. Must be set to 'major', 'minor', 'patch', or 'custom'",
"Error_NoSourceSpecifiedForPublish": "No external source was specified for publish",
"Error_NoSourceSpecifiedForDownload": "No external source was specified for download",
"Error_UnexpectedErrorArtifactTool": "An unexpected error occurred while trying to push the package. Exit code(%s) and error(%s)",
Expand Down
3 changes: 2 additions & 1 deletion Tasks/UniversalPackagesV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"category": "Package",
"version": {
"Major": 0,
"Minor": 227,
"Minor": 228,
"Patch": 0
},
"runsOn": [
Expand Down Expand Up @@ -427,6 +427,7 @@
"PackagesPublishedSuccessfully": "ms-resource:loc.messages.PackagesPublishedSuccessfully",
"PackagesFailedToPublish": "ms-resource:loc.messages.PackagesFailedToPublish",
"UnknownFeedType": "ms-resource:loc.messages.UnknownFeedType",
"Error_NoVersionOptionSpecifiedForPublish": "ms-resource:loc.messages.Error_NoVersionOptionSpecifiedForPublish",
"Error_NoSourceSpecifiedForPublish": "ms-resource:loc.messages.Error_NoSourceSpecifiedForPublish",
"Error_NoSourceSpecifiedForDownload": "ms-resource:loc.messages.Error_NoSourceSpecifiedForDownload",
"Error_UnexpectedErrorArtifactTool": "ms-resource:loc.messages.Error_UnexpectedErrorArtifactTool",
Expand Down
4 changes: 3 additions & 1 deletion Tasks/UniversalPackagesV0/universalpublish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ export async function run(artifactToolPath: string): Promise<void> {
if (versionRadio === "custom") {
version = tl.getInput("versionPublish");
}
else {
else if (versionRadio in ["major", "minor", "patch"]) {
feedUri = await pkgLocationUtils.getFeedUriFromBaseServiceUri(serviceUri, accessToken);
version = await getNextPackageVersion(feedUri, accessToken, projectId, feedId, packageName);
} else {
throw new Error(tl.loc("Error_NoVersionOptionSpecifiedForPublish"));
}
tl.debug(tl.loc("Info_UsingArtifactToolPublish"));

Expand Down

0 comments on commit 6c6ab58

Please sign in to comment.