mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1666 CommandFile: Add command and argument name to error messages
This commit is contained in:
@@ -61,7 +61,9 @@ void RicfFieldReader<QString>::readFieldData(QString& fieldValue, QTextStream& i
|
||||
{
|
||||
// Unexpected start of string, Missing '"'
|
||||
// Error message
|
||||
errorMessageContainer->addError("String argument does not seem to be quoted. Missing the start '\"'");
|
||||
errorMessageContainer->addError("String argument does not seem to be quoted. Missing the start '\"' in the \""
|
||||
+ errorMessageContainer->currentArgument + "\" argument of the command: \""
|
||||
+ errorMessageContainer->currentCommand + "\"" );
|
||||
// Could interpret as unquoted text
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,10 @@ struct RicfFieldReader
|
||||
inputStream >> fieldValue;
|
||||
if (inputStream.status() == QTextStream::ReadCorruptData)
|
||||
{
|
||||
errorMessageContainer->addError("Argument value is unreadable");
|
||||
errorMessageContainer->addError("Argument value is unreadable in the argument: \""
|
||||
+ errorMessageContainer->currentArgument + "\" in the command: \""
|
||||
+ errorMessageContainer->currentCommand + "\"" );
|
||||
|
||||
inputStream.setStatus( QTextStream::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ public:
|
||||
void addWarning(const QString& message) { m_messages.push_back(std::make_pair(WARNING, message));}
|
||||
void addError(const QString& message) { m_messages.push_back(std::make_pair(ERROR, message));}
|
||||
|
||||
QString currentCommand;
|
||||
QString currentArgument;
|
||||
std::vector<std::pair<MessageType, QString> > m_messages;
|
||||
};
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ void RicfObjectCapability::readFields(QTextStream& inputStream,
|
||||
if ( currentChar != QChar('=') )
|
||||
{
|
||||
// Error message: Missing "=" after argument name
|
||||
errorMessageContainer->addError("Can't find the '=' after the argument named: \"" + keyword);
|
||||
errorMessageContainer->addError("Can't find the '=' after the argument named: \"" + keyword + "\" in the command: \"" + errorMessageContainer->currentCommand + "\"" );
|
||||
fieldDataFound = false;
|
||||
if (currentChar == QChar(')') )
|
||||
{
|
||||
@@ -99,7 +99,7 @@ void RicfObjectCapability::readFields(QTextStream& inputStream,
|
||||
if ( readFields.count(keyword) )
|
||||
{
|
||||
// Warning message: Referenced the same argument several times
|
||||
errorMessageContainer->addWarning("The argument: \"" + keyword + "\" is referenced several times." );
|
||||
errorMessageContainer->addWarning("The argument: \"" + keyword + "\" is referenced several times in the command: \"" + errorMessageContainer->currentCommand + "\"" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,14 +115,16 @@ void RicfObjectCapability::readFields(QTextStream& inputStream,
|
||||
|
||||
if ( xmlFieldHandle->isIOReadable() )
|
||||
{
|
||||
errorMessageContainer->currentArgument = keyword;
|
||||
rcfField->readFieldData(inputStream, objectFactory, errorMessageContainer);
|
||||
errorMessageContainer->currentArgument = keyword;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Error message: Unknown argument name
|
||||
errorMessageContainer->addWarning("The argument: \"" + keyword + "\" does not exist.");
|
||||
errorMessageContainer->addWarning("The argument: \"" + keyword + "\" does not exist in the command: \"" + errorMessageContainer->currentCommand + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,9 @@ std::vector<RicfCommandObject*> RicfCommandFileReader::readCommands(QTextStream&
|
||||
{
|
||||
readCommands.push_back(cObj);
|
||||
auto rcfCap = cObj->capability<RicfObjectCapability>();
|
||||
errorMessageContainer->currentCommand = commandName;
|
||||
rcfCap->readFields(inputStream, objectFactory, errorMessageContainer);
|
||||
errorMessageContainer->currentCommand = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user