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

Plumb error reporting through registries interfaces. #1153

Merged
merged 9 commits into from
Sep 18, 2023

Conversation

BillyONeal
Copy link
Member

@BillyONeal BillyONeal commented Aug 11, 2023

More prerequisites for git mktree.

@@ -162,8 +164,8 @@ namespace vcpkg
Path path,
std::string baseline);

ExpectedL<std::vector<std::pair<SchemedVersion, std::string>>> get_builtin_versions(const VcpkgPaths& paths,
StringView port_name);
ExpectedL<Optional<std::vector<std::pair<SchemedVersion, std::string>>>> get_builtin_versions(
Copy link
Member

@vicroms vicroms Aug 18, 2023

Choose a reason for hiding this comment

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

With these return types I'm grateful that auto exists.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought the same thing when I looked at this lol

@@ -2741,6 +2734,7 @@ DECLARE_MESSAGE(VersionBuiltinPortTreeEntryMissing,
"{expected} and {actual} are versions like 1.0.",
"no version database entry for {package_name} at {expected}; using the checked out ports tree "
"version ({actual}).")
DECLARE_MESSAGE(VersionDatabaseEntriesMissing, (msg::package_name), "", "no version entries for {package_name}.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this have a {url} as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out this message is not used; deleted

Copy link
Member Author

Choose a reason for hiding this comment

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

This being in this PR is either merge gore or fallout from my other branch from which this PR was extracted and it will come back :)

error_info->error = msg::format_error(msgFailedToParseManifest, msg::path = manifest_path);
return error_info;
return ParseControlErrorInfo::from_error(
port_name, msg::format_error(msgFailedToParseManifest, msg::path = manifest_path));
Copy link
Contributor

Choose a reason for hiding this comment

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

Noting that this should probably return the underlying filesystem error (permission denied) instead of a generic "failed to parse".

No change requested in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

The other place that used this message indeed included the original message, so I added it here.

Comment on lines 1626 to 1643
auto maybe_maybe_versions =
load_versions_file(paths.get_filesystem(), VersionDbType::Git, paths.builtin_registry_versions, port_name);
auto maybe_versions = maybe_maybe_versions.get();
if (!maybe_versions)
{
return std::move(maybe_maybe_versions).error();
}

auto versions = maybe_versions->get();
if (!versions)
{
return Optional<std::vector<std::pair<SchemedVersion, std::string>>>{};
}

return Optional<std::vector<std::pair<SchemedVersion, std::string>>>{
Util::fmap(*versions, [](const VersionDbEntry& entry) -> std::pair<SchemedVersion, std::string> {
return {SchemedVersion{entry.scheme, entry.version}, entry.git_tree};
})};
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
auto maybe_maybe_versions =
load_versions_file(paths.get_filesystem(), VersionDbType::Git, paths.builtin_registry_versions, port_name);
auto maybe_versions = maybe_maybe_versions.get();
if (!maybe_versions)
{
return std::move(maybe_maybe_versions).error();
}
auto versions = maybe_versions->get();
if (!versions)
{
return Optional<std::vector<std::pair<SchemedVersion, std::string>>>{};
}
return Optional<std::vector<std::pair<SchemedVersion, std::string>>>{
Util::fmap(*versions, [](const VersionDbEntry& entry) -> std::pair<SchemedVersion, std::string> {
return {SchemedVersion{entry.scheme, entry.version}, entry.git_tree};
})};
return
load_versions_file(paths.get_filesystem(), VersionDbType::Git, paths.builtin_registry_versions, port_name).map([](const auto& maybe_versions) {
return maybe_versions.map([](const auto& versions) {
return Util::fmap(versions, [](const VersionDbEntry& entry) {
return std::pair<SchemedVersion, std::string>{{entry.scheme, entry.version}, entry.git_tree};
})};
});
});

Copy link
Member Author

Choose a reason for hiding this comment

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

Applied!

@BillyONeal BillyONeal merged commit bfdd29e into microsoft:main Sep 18, 2023
5 checks passed
@BillyONeal BillyONeal deleted the add-registry-errors branch September 18, 2023 23:55
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.

4 participants