Browse Source

IsValid check was dumb.

Sam Jaffe 6 năm trước cách đây
mục cha
commit
05aec36796
2 tập tin đã thay đổi với 4 bổ sung5 xóa
  1. 3 4
      src/loggers/properties.cxx
  2. 1 1
      test/file_appender_test.cxx

+ 3 - 4
src/loggers/properties.cxx

@@ -96,15 +96,14 @@ namespace logging {
 
   properties const & properties::operator[](std::string const & key) const {
     expects(data.is<object_t>(), invalid_property_type, "expected OBJECT");
-    expects(contains(key) && object().at(key).data.valid(),
-            missing_property, "Missing key: " + key);
+    expects(contains(key), missing_property, "Missing key: " + key);
     return object().at(key);
   }
 
   properties const & properties::operator[](std::size_t idx) const {
     expects(data.is<array_t>(), invalid_property_type, "expected ARRAY");
-    expects(contains(idx) && array().at(idx).data.valid(),
-            missing_property, "Out of bounds: " + std::to_string(idx));
+    expects(contains(idx), missing_property,
+            "Out of bounds: " + std::to_string(idx));
     return array().at(idx);
   }
   

+ 1 - 1
test/file_appender_test.cxx

@@ -54,7 +54,7 @@ FileAppenderTest::get(logging::properties const & props) const {
 
 TEST_F(FileAppenderTest, ThrowsIfNoFilename) {
   EXPECT_THROW(logging::appenders::instance().get("File", {}),
-               logging::missing_property);
+               logging::invalid_property_type);
 }
 
 std::string slurp(std::string const & filename) {