-
Notifications
You must be signed in to change notification settings - Fork 285
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
Conversation
@@ -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( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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}.") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :)
src/vcpkg/paragraphs.cpp
Outdated
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)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
src/vcpkg/registries.cpp
Outdated
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}; | ||
})}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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}; | |
})}; | |
}); | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied!
# Conflicts: # src/vcpkg/registries.cpp
More prerequisites for git mktree.