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,
183 sourceFileLineNumber,
191 <<
"--> FOAM FATAL IO ERROR:" <<
nl 195 <<
" From " << functionName <<
nl 196 <<
" in file " << sourceFileName
197 <<
" at line " << sourceFileLineNumber <<
'.' <<
std::endl;
205 dictionary errDict(error::operator dictionary());
207 errDict.add(
"type", word(
"Foam::IOerror"),
true);
208 errDict.add(
"ioFileName", ioFileName());
209 errDict.add(
"ioStartLineNumber", ioStartLineNumber());
210 errDict.add(
"ioEndLineNumber", ioEndLineNumber());
218 void Foam::IOerror::exiting(
const int errNo,
const bool isAbort)
225 IOerror errorException(*
this);
228 messageStreamPtr_->reset();
230 throw errorException;
236 jobInfo.
add(
"FatalIOError",
operator dictionary());
240 simpleExit(errNo, isAbort);
266 if (withTitle && !title().empty())
268 os << title().c_str()
278 os << message().c_str();
281 if (!ioFileName().empty())
284 <<
"file: " << ioFileName().c_str();
286 if (ioStartLineNumber() >= 0)
288 os <<
" at line " << ioStartLineNumber();
289 if (ioStartLineNumber() < ioEndLineNumber())
291 os <<
" to " << ioEndLineNumber();
298 const label lineNo = sourceFileLineNumber();
303 <<
" From " << functionName().c_str() <<
nl;
305 if (!sourceFileName().empty())
307 os <<
" in file " << sourceFileName().c_str();
311 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.
Generic output stream using a standard (STL) stream.
fileName relativeName() const
Return the name of the stream relative to the current case.
IOerror(const string &title)
Construct from title string.
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.
static void SafeFatalIOError(const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream, const string &msg)
Print basic message and exit.
A class for handling character strings derived from std::string.
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 ...