diff --git a/toolsrc/include/vcpkg/base/parse.h b/toolsrc/include/vcpkg/base/parse.h index cc5db02d375ca6..b3577e82119e89 100644 --- a/toolsrc/include/vcpkg/base/parse.h +++ b/toolsrc/include/vcpkg/base/parse.h @@ -16,6 +16,7 @@ namespace vcpkg::Parse { virtual ~IParseError() = default; virtual std::string format() const = 0; + virtual const std::string& get_message() const = 0; }; struct ParseError : IParseError @@ -38,6 +39,7 @@ namespace vcpkg::Parse const std::string message; virtual std::string format() const override; + virtual const std::string& get_message() const override; }; struct ParserBase diff --git a/toolsrc/src/vcpkg/base/parse.cpp b/toolsrc/src/vcpkg/base/parse.cpp index c6a7de83d32974..a082c4d9c710b5 100644 --- a/toolsrc/src/vcpkg/base/parse.cpp +++ b/toolsrc/src/vcpkg/base/parse.cpp @@ -50,6 +50,8 @@ namespace vcpkg::Parse "^\n"); } + const std::string& ParseError::get_message() const { return this->message; } + ParserBase::ParserBase(StringView text, StringView origin, TextRowCol init_rowcol) : m_it(text.begin(), text.end()) , m_start_of_line(m_it) diff --git a/toolsrc/src/vcpkg/binarycaching.cpp b/toolsrc/src/vcpkg/binarycaching.cpp index 8624cb3d3115fd..3c471bd1310b88 100644 --- a/toolsrc/src/vcpkg/binarycaching.cpp +++ b/toolsrc/src/vcpkg/binarycaching.cpp @@ -1131,6 +1131,7 @@ ExpectedS> vcpkg::create_binary_provider_from_c BinaryConfigParser default_parser("default,readwrite", "", &s); default_parser.parse(); + if (auto err = default_parser.get_error()) return err->get_message(); BinaryConfigParser env_parser(env_string, "VCPKG_BINARY_SOURCES", &s); env_parser.parse(); diff --git a/toolsrc/src/vcpkg/versiondeserializers.cpp b/toolsrc/src/vcpkg/versiondeserializers.cpp index 1557f4be9540b1..5c57a99222e650 100644 --- a/toolsrc/src/vcpkg/versiondeserializers.cpp +++ b/toolsrc/src/vcpkg/versiondeserializers.cpp @@ -5,14 +5,15 @@ using namespace vcpkg; using namespace vcpkg::Versions; -static constexpr StringLiteral VERSION_RELAXED = "version"; -static constexpr StringLiteral VERSION_SEMVER = "version-semver"; -static constexpr StringLiteral VERSION_STRING = "version-string"; -static constexpr StringLiteral VERSION_DATE = "version-date"; -static constexpr StringLiteral PORT_VERSION = "port-version"; - namespace { + constexpr StringLiteral VERSION_RELAXED = "version"; + constexpr StringLiteral VERSION_SEMVER = "version-semver"; + constexpr StringLiteral VERSION_STRING = "version-string"; + constexpr StringLiteral VERSION_DATE = "version-date"; + constexpr StringLiteral PORT_VERSION = "port-version"; + constexpr StringLiteral GIT_TREE = "git-tree"; + struct VersionDeserializer final : Json::IDeserializer { VersionDeserializer(StringLiteral type) : m_type(type) { }