mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: make dictionary error more descriptive (#1065)
This commit is contained in:
@ -248,7 +248,7 @@ void Foam::dictionary::checkITstream
|
||||
is.lineNumber() // ioStartLineNumber
|
||||
);
|
||||
|
||||
err << "'" << keyword << "' has "
|
||||
err << "Entry '" << keyword << "' has "
|
||||
<< remaining << " excess tokens in stream" << nl << nl
|
||||
<< " ";
|
||||
is.writeList(err, 0);
|
||||
@ -262,7 +262,7 @@ void Foam::dictionary::checkITstream
|
||||
<< "--> FOAM FATAL IO ERROR:" << nl;
|
||||
|
||||
std::cerr
|
||||
<< "'" << keyword << "' has "
|
||||
<< "Entry '" << keyword << "' has "
|
||||
<< remaining << " excess tokens in stream" << nl << nl;
|
||||
|
||||
std::cerr
|
||||
@ -286,7 +286,8 @@ void Foam::dictionary::checkITstream
|
||||
this->name(), // ioFileName
|
||||
is.lineNumber() // ioStartLineNumber
|
||||
)
|
||||
<< "'" << keyword << "' had no tokens in stream" << nl << nl
|
||||
<< "Entry '" << keyword
|
||||
<< "' had no tokens in stream" << nl << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else
|
||||
@ -294,7 +295,8 @@ void Foam::dictionary::checkITstream
|
||||
std::cerr
|
||||
<< nl
|
||||
<< "--> FOAM FATAL IO ERROR:" << nl
|
||||
<< "'" << keyword << "' had no tokens in stream" << nl << nl;
|
||||
<< "Entry '" << keyword
|
||||
<< "' had no tokens in stream" << nl << nl;
|
||||
|
||||
std::cerr
|
||||
<< "file: " << this->name()
|
||||
@ -358,7 +360,7 @@ const Foam::entry& Foam::dictionary::lookupEntry
|
||||
if (!finder.found())
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "'" << keyword << "' not found in dictionary "
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
@ -472,7 +474,7 @@ const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const
|
||||
if (!finder.found())
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "'" << keyword << "' not found in dictionary "
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
@ -489,7 +491,7 @@ Foam::dictionary& Foam::dictionary::subDict(const word& keyword)
|
||||
if (!finder.found())
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "'" << keyword << "' not found in dictionary "
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
@ -516,7 +518,7 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
|
||||
if (mandatory)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "'" << keyword
|
||||
<< "Entry '" << keyword
|
||||
<< "' is not a sub-dictionary in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
@ -525,7 +527,7 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
|
||||
if (finder.found())
|
||||
{
|
||||
IOWarningInFunction(*this)
|
||||
<< "'" << keyword
|
||||
<< "Entry '" << keyword
|
||||
<< "' found but not a sub-dictionary in dictionary "
|
||||
<< name() << endl;
|
||||
}
|
||||
@ -551,7 +553,7 @@ const Foam::dictionary& Foam::dictionary::optionalSubDict
|
||||
if (finder.found())
|
||||
{
|
||||
IOWarningInFunction(*this)
|
||||
<< "'" << keyword
|
||||
<< "Entry '" << keyword
|
||||
<< "' found but not a sub-dictionary in dictionary "
|
||||
<< name() << endl;
|
||||
}
|
||||
@ -639,7 +641,7 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
|
||||
IOWarningInFunction(*this)
|
||||
<< "problem replacing entry "<< entryPtr->keyword()
|
||||
<< "Problem replacing entry "<< entryPtr->keyword()
|
||||
<< " in dictionary " << name() << endl;
|
||||
|
||||
parent_type::remove(entryPtr);
|
||||
@ -665,9 +667,8 @@ Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
|
||||
IOWarningInFunction(*this)
|
||||
<< "attempt to add entry " << entryPtr->keyword()
|
||||
<< " which already exists in dictionary " << name()
|
||||
<< endl;
|
||||
<< "Attempt to add entry " << entryPtr->keyword()
|
||||
<< " which already exists in dictionary " << name() << endl;
|
||||
|
||||
delete entryPtr;
|
||||
return nullptr;
|
||||
@ -772,7 +773,8 @@ bool Foam::dictionary::merge(const dictionary& dict)
|
||||
if (this == &dict)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "attempted merge to self for dictionary " << name()
|
||||
<< "Attempted merge to self for dictionary "
|
||||
<< name()
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
|
||||
@ -840,7 +842,8 @@ void Foam::dictionary::operator=(const dictionary& rhs)
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "attempted assignment to self for dictionary " << name()
|
||||
<< "Attempted assignment to self for dictionary "
|
||||
<< name()
|
||||
<< abort(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchCompat
|
||||
std::cerr
|
||||
<< "--> FOAM IOWarning :" << nl
|
||||
<< " Found [v" << iter.second << "] '"
|
||||
<< iter.first << "' instead of '"
|
||||
<< iter.first << "' entry instead of '"
|
||||
<< keyword.c_str() << "' in dictionary \""
|
||||
<< name().c_str() << "\" "
|
||||
<< nl
|
||||
@ -128,7 +128,7 @@ const Foam::entry& Foam::dictionary::lookupEntryCompat
|
||||
if (!finder.found())
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "'" << keyword << "' not found in dictionary "
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ bool Foam::dictionary::read(Istream& is, bool keepHeader)
|
||||
if (!is.good())
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "Istream not OK for reading dictionary "
|
||||
<< "Istream not OK for reading dictionary " << name()
|
||||
<< exit(FatalIOError);
|
||||
|
||||
return false;
|
||||
@ -102,7 +102,7 @@ bool Foam::dictionary::read(Istream& is, bool keepHeader)
|
||||
if (currToken == token::END_BLOCK)
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "Dictionary input cannot start with '}'"
|
||||
<< "Dictionary input cannot start with '}'" << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else if (currToken != token::BEGIN_BLOCK)
|
||||
@ -185,7 +185,7 @@ void Foam::dictionary::writeEntries(Ostream& os, const bool extraNewLine) const
|
||||
if (!os.good())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Can't write entry " << e.keyword()
|
||||
<< "Cannot write entry " << e.keyword()
|
||||
<< " for dictionary " << name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -629,9 +629,8 @@ bool Foam::dictionary::changeKeyword
|
||||
if (iter()->keyword().isPattern())
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Old keyword "<< oldKeyword
|
||||
<< " is a pattern."
|
||||
<< "Pattern replacement not yet implemented."
|
||||
<< "Old keyword " << oldKeyword << " is a pattern." << nl
|
||||
<< "Pattern replacement is not supported." << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -664,7 +663,7 @@ bool Foam::dictionary::changeKeyword
|
||||
else
|
||||
{
|
||||
IOWarningInFunction(*this)
|
||||
<< "cannot rename keyword "<< oldKeyword
|
||||
<< "Cannot rename keyword " << oldKeyword
|
||||
<< " to existing keyword " << newKeyword
|
||||
<< " in dictionary " << name() << endl;
|
||||
return false;
|
||||
|
||||
@ -100,7 +100,8 @@ bool Foam::dictionary::readCompat
|
||||
else if (mandatory)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Entry '" << keyword << "' not found in dictionary " << name()
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -198,7 +199,8 @@ bool Foam::dictionary::readEntry
|
||||
else if (mandatory)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "Entry '" << keyword << "' not found in dictionary " << name()
|
||||
<< "Entry '" << keyword << "' not found in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ void Foam::entry::checkITstream(const ITstream& is) const
|
||||
is.lineNumber() // ioStartLineNumber
|
||||
);
|
||||
|
||||
err << "'" << keyword << "' has "
|
||||
err << "Entry '" << keyword << "' has "
|
||||
<< remaining << " excess tokens in stream" << nl << nl
|
||||
<< " ";
|
||||
is.writeList(err, 0);
|
||||
@ -106,7 +106,7 @@ void Foam::entry::checkITstream(const ITstream& is) const
|
||||
<< "--> FOAM FATAL IO ERROR:" << nl;
|
||||
|
||||
std::cerr
|
||||
<< "'" << keyword << "' has "
|
||||
<< "Entry '" << keyword << "' has "
|
||||
<< remaining << " excess tokens in stream" << nl << nl;
|
||||
|
||||
std::cerr
|
||||
@ -130,7 +130,8 @@ void Foam::entry::checkITstream(const ITstream& is) const
|
||||
this->name(), // ioFileName
|
||||
is.lineNumber() // ioStartLineNumber
|
||||
)
|
||||
<< "'" << keyword << "' had no tokens in stream" << nl << nl
|
||||
<< "Entry '" << keyword
|
||||
<< "' had no tokens in stream" << nl << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else
|
||||
@ -138,7 +139,8 @@ void Foam::entry::checkITstream(const ITstream& is) const
|
||||
std::cerr
|
||||
<< nl
|
||||
<< "--> FOAM FATAL IO ERROR:" << nl
|
||||
<< "'" << keyword << "' had no tokens in stream" << nl << nl;
|
||||
<< "Entry '" << keyword
|
||||
<< "' had no tokens in stream" << nl << nl;
|
||||
|
||||
std::cerr
|
||||
<< "file: " << this->name()
|
||||
|
||||
@ -213,7 +213,7 @@ void Foam::argList::checkITstream(const ITstream& is, const label index)
|
||||
std::cerr
|
||||
<< nl
|
||||
<< "--> FOAM WARNING:" << nl
|
||||
<< "argument " << index << " has "
|
||||
<< "Argument " << index << " has "
|
||||
<< remaining << " excess tokens" << nl << nl;
|
||||
}
|
||||
else if (!is.size())
|
||||
@ -221,7 +221,7 @@ void Foam::argList::checkITstream(const ITstream& is, const label index)
|
||||
std::cerr
|
||||
<< nl
|
||||
<< "--> FOAM WARNING:" << nl
|
||||
<< "argument " << index << " had no tokens" << nl << nl;
|
||||
<< "Argument " << index << " had no tokens" << nl << nl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ void Foam::argList::checkITstream(const ITstream& is, const word& optName)
|
||||
std::cerr
|
||||
<< nl
|
||||
<< "--> FOAM WARNING:" << nl
|
||||
<< "option -" << optName << " has "
|
||||
<< "Option -" << optName << " has "
|
||||
<< remaining << " excess tokens" << nl << nl;
|
||||
}
|
||||
else if (!is.size())
|
||||
@ -243,7 +243,7 @@ void Foam::argList::checkITstream(const ITstream& is, const word& optName)
|
||||
std::cerr
|
||||
<< nl
|
||||
<< "--> FOAM WARNING:" << nl
|
||||
<< "option -" << optName << " had no tokens" << nl << nl;
|
||||
<< "Option -" << optName << " had no tokens" << nl << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user