Merge "Rework dump command parsing"
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 96b7e6e..4b65e13 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -374,12 +374,14 @@
 
 void YangSchema::enableFeature(const std::string& moduleName, const std::string& featureName)
 {
+    using namespace std::string_literals;
     auto module = getYangModule(moduleName);
     if (!module) {
-        using namespace std::string_literals;
         throw std::runtime_error("Module \""s + moduleName + "\" doesn't exist.");
     }
-    module->feature_enable(featureName.c_str());
+    if (module->feature_enable(featureName.c_str())) {
+        throw std::runtime_error("Can't enable feature \""s + featureName + "\" for module \"" + moduleName + "\".");
+    }
 }
 
 void YangSchema::registerModuleCallback(const std::function<std::string(const char*, const char*, const char*, const char*)>& clb)
diff --git a/tests/yang.cpp b/tests/yang.cpp
index 833ef70..843e1a8 100644
--- a/tests/yang.cpp
+++ b/tests/yang.cpp
@@ -1188,5 +1188,10 @@
         {
             REQUIRE_THROWS_AS(ys.enableFeature("non-existing", "just-no"), std::runtime_error);
         }
+
+        SECTION("enableFeature - non existing feature")
+        {
+            REQUIRE_THROWS_AS(ys.enableFeature("example-schema", "just-no"), std::runtime_error);
+        }
     }
 }