aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_search.cpp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-06-08 00:36:17 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-06-08 04:32:57 -0700
commit247a6cec90004b8666d155eacc0f27d3a6c8fcf9 (patch)
treee63038044933f747161f94f52fc35f435573d08b /toolsrc/src/commands_search.cpp
parent1b717d851fda51e03b98a18f5304e29b7876c8a3 (diff)
downloadvcpkg-247a6cec90004b8666d155eacc0f27d3a6c8fcf9.tar.gz
vcpkg-247a6cec90004b8666d155eacc0f27d3a6c8fcf9.zip
[vcpkg] Improve diagnostics upon port load failure
Diffstat (limited to 'toolsrc/src/commands_search.cpp')
-rw-r--r--toolsrc/src/commands_search.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/toolsrc/src/commands_search.cpp b/toolsrc/src/commands_search.cpp
index 739aa0f43..4b7f49ba8 100644
--- a/toolsrc/src/commands_search.cpp
+++ b/toolsrc/src/commands_search.cpp
@@ -4,6 +4,7 @@
#include "SourceParagraph.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
+#include "vcpkglib.h"
#include "vcpkglib_helpers.h"
namespace vcpkg::Commands::Search
@@ -61,8 +62,28 @@ namespace vcpkg::Commands::Search
args.check_max_arg_count(1, example);
const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_GRAPH});
- const std::vector<SourceParagraph> source_paragraphs =
- Paragraphs::load_all_ports(paths.get_filesystem(), paths.ports);
+ auto sources_and_errors = Paragraphs::try_load_all_ports(paths.get_filesystem(), paths.ports);
+
+ if (!sources_and_errors.errors.empty())
+ {
+ if (vcpkg::g_debugging)
+ {
+ print_error_message(sources_and_errors.errors);
+ }
+ else
+ {
+ for (auto&& error : sources_and_errors.errors)
+ {
+ System::println(
+ System::Color::warning, "Warning: an error occurred while parsing '%s'\n", error.name);
+ }
+ System::println(System::Color::warning,
+ "Use '--debug' to get more information about the parse failures.\n");
+ }
+ }
+
+ auto& source_paragraphs = sources_and_errors.paragraphs;
+
if (options.find(OPTION_GRAPH) != options.cend())
{
const std::string graph_as_string = create_graph_as_string(source_paragraphs);