From d50401a5623cd6fcd307d4c41c9d89b490c7eebd Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Wed, 28 Dec 2016 16:45:13 +0100 Subject: [PATCH] validator: print limits of min/max-values in error messages --- src/json-validator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/json-validator.cpp b/src/json-validator.cpp index 98a4c72..a816296 100644 --- a/src/json-validator.cpp +++ b/src/json-validator.cpp @@ -189,7 +189,7 @@ void validate_numeric(const json &schema, const std::string &name, double value) const auto &maximum = schema.find("maximum"); if (maximum != schema.end()) { double maxi = maximum.value(); - auto ex = std::out_of_range(name + " exceeds maximum of ..."); + auto ex = std::out_of_range(name + " exceeds maximum of " + std::to_string(maxi)); if (schema.find("exclusiveMaximum") != schema.end()) { if (value >= maxi) throw ex; @@ -202,7 +202,7 @@ void validate_numeric(const json &schema, const std::string &name, double value) const auto &minimum = schema.find("minimum"); if (minimum != schema.end()) { double mini = minimum.value(); - auto ex = std::out_of_range(name + " exceeds minimum of ..."); + auto ex = std::out_of_range(name + " exceeds minimum of " + std::to_string(mini)); if (schema.find("exclusiveMinimum") != schema.end()) { if (value <= mini) throw ex;