From ec4d260f9ca9c3874556d656bd996a85d3050999 Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Thu, 12 Jan 2017 16:18:00 +0100 Subject: [PATCH] type-validation: better error message when type-check has failed --- src/json-validator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/json-validator.cpp b/src/json-validator.cpp index d73b473..47cb626 100644 --- a/src/json-validator.cpp +++ b/src/json-validator.cpp @@ -146,7 +146,8 @@ void validate_type(const json &schema, const std::string &expected_type, const s (type_instance == "number" && expected_type == "integer")) return; - throw std::invalid_argument(type_instance.get() + " is not a " + expected_type + " for " + name); + throw std::invalid_argument(name + " should be a " + expected_type + + ", but is a " + type_instance.get()); } }