Salome HOME
Issue #1343 Improvement of Extrusion and Revolution operations: sketcher start or...
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_Validators.cpp
index 052140b8136f963bfb02118b346d0a8a06e4de56..e0579464007a69089e5e9578d58dfcb40bb747bb 100644 (file)
@@ -38,19 +38,26 @@ bool ExchangePlugin_FormatValidator::parseFormats(const std::list<std::string>&
 }
 
 bool ExchangePlugin_FormatValidator::isValid(const AttributePtr& theAttribute,
-                                             const std::list<std::string>& theArguments) const
+                                             const std::list<std::string>& theArguments,
+                                             std::string& theError) const
 {
-  if (!theAttribute->isInitialized())
+  if (!theAttribute->isInitialized()) {
+    theError = "Is not initialized.";
     return false;
+  }
 
   const AttributeStringPtr aStrAttr =
       std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
-  if (!aStrAttr)
+  if (!aStrAttr) {
+    theError = "Is not a string attribute.";
     return false;
+  }
 
   std::string aFileName = aStrAttr->value();
-  if (aFileName.empty())
+  if (aFileName.empty()) {
+    theError = "File name is empty.";
     return false;
+  }
 
   std::list<std::string> aFormats;
   ExchangePlugin_FormatValidator::parseFormats(theArguments, aFormats);
@@ -66,5 +73,6 @@ bool ExchangePlugin_FormatValidator::isValid(const AttributePtr& theAttribute,
       }
     }
   }
+  theError = "File name does not end with any available format.";
   return false;
 }