Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return error codes for dependencies failure #2410

Merged

Conversation

hackean-msft
Copy link
Contributor

@hackean-msft hackean-msft commented Aug 3, 2022

The goal of these change is to allow the WinGetValidateManifestV3 to return dependencies failure as error code for programmatic usage. This prevents the need to parse strings to decode the different failure types associated with dependences.

Changes:

  • Use localized messages for validation errors.
  • Parse exceptions to decode failure types and surface that to the caller.
Microsoft Reviewers: Open in CodeFlow

@hackean-msft hackean-msft requested a review from a team as a code owner August 3, 2022 16:26
{ AppInstaller::Manifest::ManifestError::DuplicateReturnCodeEntry, "Duplicate installer return code found." },
{ AppInstaller::Manifest::ManifestError::FieldRequireVerifiedPublisher, "Field usage requires verified publishers." },
{ AppInstaller::Manifest::ManifestError::SingleManifestPackageHasDependencies, "Package has a single manifest and is a dependency of other manifests." },
{ AppInstaller::Manifest::ManifestError::MultiManifestPackageHasDependencies, "Deleting the manifest will be break the following dependencies." },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ AppInstaller::Manifest::ManifestError::MultiManifestPackageHasDependencies, "Deleting the manifest will be break the following dependencies." },
{ AppInstaller::Manifest::ManifestError::MultiManifestPackageHasDependencies, "Deleting the manifest will break the following dependencies." },

{ AppInstaller::Manifest::ManifestError::RequiredFieldEmpty, "Required field with empty value." },
{ AppInstaller::Manifest::ManifestError::RequiredFieldMissing, "Required field missing." },
{ AppInstaller::Manifest::ManifestError::InvalidFieldValue, "Invalid field value." },
{ AppInstaller::Manifest::ManifestError::ExeInstallerMissingSilentSwitches, "Silent and SilentWithProgress switches are not specified for InstallerType exe.Please make sure the installer can run unattended." },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ AppInstaller::Manifest::ManifestError::ExeInstallerMissingSilentSwitches, "Silent and SilentWithProgress switches are not specified for InstallerType exe.Please make sure the installer can run unattended." },
{ AppInstaller::Manifest::ManifestError::ExeInstallerMissingSilentSwitches, "Silent and SilentWithProgress switches are not specified for InstallerType 'exe'. Please make sure the installer can run unattended." },

{ AppInstaller::Manifest::ManifestError::DuplicateInstallerEntry, "Duplicate installer entry found." },
{ AppInstaller::Manifest::ManifestError::InstallerTypeDoesNotSupportPackageFamilyName, "The specified installer type does not support PackageFamilyName." },
{ AppInstaller::Manifest::ManifestError::InstallerTypeDoesNotSupportProductCode, "The specified installer type does not support ProductCode." },
{ AppInstaller::Manifest::ManifestError::InstallerTypeDoesNotWriteAppsAndFeaturesEntry, "The specified installer type does not write to Apps and Features entry." },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ AppInstaller::Manifest::ManifestError::InstallerTypeDoesNotWriteAppsAndFeaturesEntry, "The specified installer type does not write to Apps and Features entry." },
{ AppInstaller::Manifest::ManifestError::InstallerTypeDoesNotWriteAppsAndFeaturesEntry, "The specified installer type does not write an entry to Apps and Features." },

{ AppInstaller::Manifest::ManifestError::InstallerTypeDoesNotSupportPackageFamilyName, "The specified installer type does not support PackageFamilyName." },
{ AppInstaller::Manifest::ManifestError::InstallerTypeDoesNotSupportProductCode, "The specified installer type does not support ProductCode." },
{ AppInstaller::Manifest::ManifestError::InstallerTypeDoesNotWriteAppsAndFeaturesEntry, "The specified installer type does not write to Apps and Features entry." },
{ AppInstaller::Manifest::ManifestError::IncompleteMultiFileManifest, "The multi file manifest is incomplete.A multi file manifest must contain at least version, installer and defaultLocale manifest."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ AppInstaller::Manifest::ManifestError::IncompleteMultiFileManifest, "The multi file manifest is incomplete.A multi file manifest must contain at least version, installer and defaultLocale manifest."},
{ AppInstaller::Manifest::ManifestError::IncompleteMultiFileManifest, "The multi file manifest is incomplete. A multi file manifest must contain at least a version, installer, and defaultLocale manifest file."},

{ AppInstaller::Manifest::ManifestError::InconsistentMultiFileManifestFieldValue, "The multi file manifest has inconsistent field values." },
{ AppInstaller::Manifest::ManifestError::DuplicateMultiFileManifestType, "The multi file manifest should contain only one file with the particular ManifestType." },
{ AppInstaller::Manifest::ManifestError::DuplicateMultiFileManifestLocale, "The multi file manifest contains duplicate PackageLocale." },
{ AppInstaller::Manifest::ManifestError::UnsupportedMultiFileManifestType, "The multi file manifest should not contain file with the particular ManifestType." },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ AppInstaller::Manifest::ManifestError::UnsupportedMultiFileManifestType, "The multi file manifest should not contain file with the particular ManifestType." },
{ AppInstaller::Manifest::ManifestError::UnsupportedMultiFileManifestType, "The multi file manifest should not contain a file with the particular ManifestType." },

{ AppInstaller::Manifest::ManifestError::InstallerFailedToProcess, "Failed to process installer." },
{ AppInstaller::Manifest::ManifestError::NoSupportedPlatforms, "No supported platforms." },
{ AppInstaller::Manifest::ManifestError::ApproximateVersionNotAllowed, "Approximate version not allowed." },
{ AppInstaller::Manifest::ManifestError::ArpVersionOverlapWithIndex, "DisplayVersion declared in the manifest has overlap with existing DisplayVersion range in the index.Existing DisplayVersion range in index : " },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ AppInstaller::Manifest::ManifestError::ArpVersionOverlapWithIndex, "DisplayVersion declared in the manifest has overlap with existing DisplayVersion range in the index.Existing DisplayVersion range in index : " },
{ AppInstaller::Manifest::ManifestError::ArpVersionOverlapWithIndex, "DisplayVersion declared in the manifest has overlap with existing DisplayVersion range in the index. Existing DisplayVersion range in index : " },

src/AppInstallerCommonCore/Manifest/ManifestValidation.cpp Outdated Show resolved Hide resolved
@JohnMcPMS
Copy link
Member

Note to other reviewers: The main goal of the change was to get the specifics of the errors out of the function, but I suggested that it be done this way in order to move 1 step closer to actually localizing these messages (and any/all others in common).

src/AppInstallerCommonCore/Manifest/ManifestValidation.cpp Outdated Show resolved Hide resolved
src/AppInstallerCommonCore/Manifest/ManifestValidation.cpp Outdated Show resolved Hide resolved

if (itr != dependenciesErrorMessageMap.end())
{
return itr->second;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we || together all of the errors that we find?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependencies error are mutually exclusive, Renamed the method name to properly convey its functionality.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think || is more future proof

@ghost ghost added the Needs-Author-Feedback Issue needs attention from issue or PR author label Aug 10, 2022
@ghost ghost added the No-Recent-Activity Issue has no recent activity label Aug 18, 2022
@ghost
Copy link

ghost commented Aug 18, 2022

@hackean-msft this pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

Copy link
Member

@JohnMcPMS JohnMcPMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing my blocking status for now.

@ghost ghost removed the No-Recent-Activity Issue has no recent activity label Aug 18, 2022
@JohnMcPMS JohnMcPMS self-requested a review August 18, 2022 21:28
@ghost ghost removed the Needs-Author-Feedback Issue needs attention from issue or PR author label Aug 22, 2022
Copy link
Contributor

@yao-msft yao-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

@ghost ghost added the Needs-Author-Feedback Issue needs attention from issue or PR author label Aug 24, 2022
@ghost ghost removed the Needs-Author-Feedback Issue needs attention from issue or PR author label Aug 29, 2022
@yao-msft yao-msft dismissed their stale review September 2, 2022 00:17

Not blocking

@JohnMcPMS JohnMcPMS removed their request for review September 13, 2022 18:28
@JohnMcPMS JohnMcPMS dismissed their stale review September 13, 2022 18:38

Original issues resolved, others have reviewed.

@hackean-msft hackean-msft merged commit 993de6b into microsoft:master Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants