Add space to error message
authorAndrey Goder <agoder@fb.com>
Wed, 29 Jul 2015 15:24:28 +0000 (08:24 -0700)
committerfacebook-github-bot-4 <folly-bot@fb.com>
Wed, 29 Jul 2015 16:22:09 +0000 (09:22 -0700)
Summary: Before this change you would get an error like:
"Expected to get greater than or equal to1 for value 0"

Now it add in the space correctly:
"Expected to get greater than or equal to 1 for value 0"

Reviewed By: @snarkmaster

Differential Revision: D2288454

folly/experimental/JSONSchema.cpp

index 9283ee36d3ca79a789eda3281071adb62aaa035d..af97dac7b0761886363ad5e4b059c37fa2f38f2b 100644 (file)
@@ -164,21 +164,21 @@ struct ComparisonValidator final : IValidator {
     if (type_ == Type::MIN) {
       if (exclusive_) {
         if (v <= s) {
-          return makeError("greater than", schema_, value);
+          return makeError("greater than ", schema_, value);
         }
       } else {
         if (v < s) {
-          return makeError("greater than or equal to", schema_, value);
+          return makeError("greater than or equal to ", schema_, value);
         }
       }
     } else if (type_ == Type::MAX) {
       if (exclusive_) {
         if (v >= s) {
-          return makeError("less than", schema_, value);
+          return makeError("less than ", schema_, value);
         }
       } else {
         if (v > s) {
-          return makeError("less than or equal to", schema_, value);
+          return makeError("less than or equal to ", schema_, value);
         }
       }
     }
@@ -352,7 +352,7 @@ struct RequiredValidator final : IValidator {
     if (value.isObject()) {
       for (const auto& prop : properties_) {
         if (!value.get_ptr(prop)) {
-          return makeError("to have property", prop, value);
+          return makeError("property ", prop, value);
         }
       }
     }
@@ -481,7 +481,7 @@ struct DependencyValidator final : IValidator {
       if (value.count(pair.first)) {
         for (const auto& prop : pair.second) {
           if (!value.count(prop)) {
-            return makeError("property", prop, value);
+            return makeError("property ", prop, value);
           }
         }
       }