Go to the documentation of this file.
41 ioFileName_(
"unknown"),
42 ioStartLineNumber_(-1),
50 ioFileName_(errDict.
get<
string>(
"ioFileName")),
51 ioStartLineNumber_(errDict.
get<label>(
"ioStartLineNumber")),
52 ioEndLineNumber_(errDict.
get<label>(
"ioEndLineNumber"))
66 const char* functionName,
67 const char* sourceFileName,
68 const int sourceFileLineNumber,
69 const string& ioFileName,
70 const label ioStartLineNumber,
71 const label ioEndLineNumber
81 ioFileName_ = ioFileName;
82 ioStartLineNumber_ = ioStartLineNumber;
83 ioEndLineNumber_ = ioEndLineNumber;
91 const char* functionName,
92 const char* sourceFileName,
93 const int sourceFileLineNumber,
101 sourceFileLineNumber,
111 const char* functionName,
112 const char* sourceFileName,
113 const int sourceFileLineNumber,
121 sourceFileLineNumber,
131 const std::string& where,
149 const std::string& where,
167 const char* functionName,
168 const char* sourceFileName,
169 const int sourceFileLineNumber,
180 sourceFileLineNumber,
188 <<
"--> FOAM FATAL IO ERROR:" <<
nl
192 <<
" From " << functionName <<
nl
193 <<
" in file " << sourceFileName
194 <<
" at line " << sourceFileLineNumber <<
'.' <<
std::endl;
204 errDict.add(
"type",
word(
"Foam::IOerror"),
true);
205 errDict.add(
"ioFileName", ioFileName());
206 errDict.add(
"ioStartLineNumber", ioStartLineNumber());
207 errDict.add(
"ioEndLineNumber", ioEndLineNumber());
215 void Foam::IOerror::exiting(
const int errNo,
const bool isAbort)
222 IOerror errorException(*
this);
225 messageStreamPtr_->reset();
227 throw errorException;
233 jobInfo.
add(
"FatalIOError",
operator dictionary());
237 simpleExit(errNo, isAbort);
263 if (withTitle && !title().empty())
265 os << title().c_str()
275 os << message().c_str();
278 if (!ioFileName().empty())
281 <<
"file: " << ioFileName().c_str();
283 if (ioStartLineNumber() >= 0)
285 os <<
" at line " << ioStartLineNumber();
286 if (ioStartLineNumber() < ioEndLineNumber())
288 os <<
" to " << ioEndLineNumber();
295 const label lineNo = sourceFileLineNumber();
300 <<
" From " << functionName().c_str() <<
nl;
302 if (!sourceFileName().empty())
304 os <<
" in file " << sourceFileName().c_str();
308 os <<
" at line " << lineNo <<
'.';
void abort()
Abort : used to stop code for fatal errors.
A class for handling words, derived from Foam::string.
IOerror(const string &title)
Construct from title string.
static int level
The output level (verbosity) of messages.
An IOstream is an abstract base class for all input/output systems; be they streams,...
label lineNumber() const noexcept
Const access to the current stream line number.
Input/output from string buffers.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A class for handling character strings derived from std::string.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
static void SafeFatalIOError(const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream, const string &msg)
Print basic message and exit.
fileName relativeName(const bool caseTag=false) const
The dictionary name relative to the case.
label startLineNumber() const
Return line number of first token in dictionary.
label endLineNumber() const
Return line number of last token in dictionary.
Generic output stream using a standard (STL) stream.
virtual ~IOerror() noexcept
Destructor.
static void shutdown()
Simple shutdown (finalize) of JobInfo.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
fileName relativeName() const
Return the name of the stream relative to the current case.
bool bad() const noexcept
True if stream is corrupted.
static bool useAbort()
True if FOAM_ABORT is on.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
const std::string patch
OpenFOAM patch number as a std::string.
static bool constructed
Global value for constructed job info.
virtual void write(Ostream &os, const bool withTitle=true) const
Print error message.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Class to handle errors and exceptions in a simple, consistent stream-based manner.