44 ioFileName_(
"unknown"),
45 ioStartLineNumber_(-1),
53 ioFileName_(errDict.
get<
string>(
"ioFileName")),
54 ioStartLineNumber_(errDict.
get<label>(
"ioStartLineNumber")),
55 ioEndLineNumber_(errDict.
get<label>(
"ioEndLineNumber"))
69 const char* functionName,
70 const char* sourceFileName,
71 const int sourceFileLineNumber,
72 const string& ioFileName,
73 const label ioStartLineNumber,
74 const label ioEndLineNumber
84 ioFileName_ = ioFileName;
85 ioStartLineNumber_ = ioStartLineNumber;
86 ioEndLineNumber_ = ioEndLineNumber;
94 const char* functionName,
95 const char* sourceFileName,
96 const int sourceFileLineNumber,
104 sourceFileLineNumber,
114 const char* functionName,
115 const char* sourceFileName,
116 const int sourceFileLineNumber,
124 sourceFileLineNumber,
134 const std::string& where,
152 const std::string& where,
170 const char* functionName,
171 const char* sourceFileName,
172 const int sourceFileLineNumber,
174 const std::string& msg
183 sourceFileLineNumber,
192 <<
"--> FOAM FATAL IO ERROR:" <<
nl 196 <<
" From " << functionName <<
nl 197 <<
" in file " << sourceFileName
198 <<
" at line " << sourceFileLineNumber <<
'.' <<
std::endl;
208 errDict.add(
"type", word(
"Foam::IOerror"),
true);
209 errDict.add(
"ioFileName", ioFileName());
210 errDict.add(
"ioStartLineNumber", ioStartLineNumber());
211 errDict.add(
"ioEndLineNumber", ioEndLineNumber());
219 void Foam::IOerror::exiting(
const int errNo,
const bool isAbort)
226 IOerror errorException(*
this);
231 throw errorException;
241 simpleExit(errNo, isAbort);
267 if (withTitle && !title().empty())
269 os << title().c_str()
279 os << message().c_str();
282 if (!ioFileName().empty())
285 <<
"file: " << ioFileName().c_str();
287 if (ioStartLineNumber() >= 0)
289 os <<
" at line " << ioStartLineNumber();
290 if (ioStartLineNumber() < ioEndLineNumber())
292 os <<
" to " << ioEndLineNumber();
299 const label lineNo = sourceFileLineNumber();
304 <<
" From " << functionName().c_str() <<
nl;
306 if (!sourceFileName().empty())
308 os <<
" in file " << sourceFileName().c_str();
312 os <<
" at line " << lineNo <<
'.';
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
IOerror(const char *title)
Construct from title string.
Generic output stream using a standard (STL) stream.
fileName relativeName() const
Return the name of the stream relative to the current case.
void clear() const
Clear any accumulated error messages.
label endLineNumber() const
Return line number of last token in dictionary.
bool bad() const noexcept
True if stream is corrupted.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void abort()
Abort : used to stop code for fatal errors.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Input/output from string buffers.
virtual ~IOerror() noexcept
Destructor.
constexpr char nl
The newline '\n' character (0x0a)
static void shutdown()
Simple shutdown (finalize) of JobInfo.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool patched()
Test if the patch string appears to be in use, which is when it is defined (non-zero).
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
static bool useAbort()
True if FOAM_ABORT is on.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
const int api
OpenFOAM api number (integer) corresponding to the value of OPENFOAM at the time of compilation...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
OBJstream os(runTime.globalPath()/outputName)
fileName relativeName(const bool caseTag=false) const
The dictionary name relative to the case.
virtual void write(Ostream &os, const bool withTitle=true) const
Print error message.
label lineNumber() const noexcept
Const access to the current stream line number.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc.
const std::string patch
OpenFOAM patch number as a std::string.
A class for handling character strings derived from std::string.
static void SafeFatalIOError(const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream, const std::string &msg)
Print basic message and exit.
static int level
The output level (verbosity) of messages.
label startLineNumber() const
Return line number of first token in dictionary.
static bool constructed
Global value for constructed job info.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...