aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/Paragraphs.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-01-24 18:00:43 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2017-01-24 18:00:43 -0800
commit7fe735c02e37057596396d42b17caef3169415b0 (patch)
tree67e3fee77fc4f7f5acd54518ae10e4fb2a35a842 /toolsrc/src/Paragraphs.cpp
parentaf0727cbc000ff2b9d3d7489c417d69170fc3a5f (diff)
downloadvcpkg-7fe735c02e37057596396d42b17caef3169415b0.tar.gz
vcpkg-7fe735c02e37057596396d42b17caef3169415b0.zip
Add error message when CONTROL file cannot be opened
Diffstat (limited to 'toolsrc/src/Paragraphs.cpp')
-rw-r--r--toolsrc/src/Paragraphs.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp
index d99ad45cf..f4592afed 100644
--- a/toolsrc/src/Paragraphs.cpp
+++ b/toolsrc/src/Paragraphs.cpp
@@ -41,8 +41,8 @@ namespace vcpkg::Paragraphs
static bool is_alphanum(char ch)
{
return (ch >= 'A' && ch <= 'Z')
- || (ch >= 'a' && ch <= 'z')
- || (ch >= '0' && ch <= '9');
+ || (ch >= 'a' && ch <= 'z')
+ || (ch >= '0' && ch <= '9');
}
static bool is_lineend(char ch)
@@ -153,7 +153,13 @@ namespace vcpkg::Paragraphs
std::vector<std::unordered_map<std::string, std::string>> get_paragraphs(const fs::path& control_path)
{
- return parse_paragraphs(Files::read_contents(control_path).get_or_throw());
+ const expected<std::string> contents = Files::read_contents(control_path);
+ if (auto spgh = contents.get())
+ {
+ return parse_paragraphs(*spgh);
+ }
+
+ Checks::exit_with_message("Error while reading %s: %s", control_path.generic_string(), contents.error_code().message());
}
std::vector<std::unordered_map<std::string, std::string>> parse_paragraphs(const std::string& str)