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
75 ioFileName_ = ioFileName;
76 ioStartLineNumber_ = ioStartLineNumber;
77 ioEndLineNumber_ = ioEndLineNumber;
85 const char* functionName,
86 const char* sourceFileName,
87 const int sourceFileLineNumber,
105 const char* functionName,
106 const char* sourceFileName,
107 const int sourceFileLineNumber,
115 sourceFileLineNumber,
125 const char* functionName,
126 const char* sourceFileName,
127 const int sourceFileLineNumber,
138 sourceFileLineNumber,
146 <<
"--> FOAM FATAL IO ERROR:" <<
nl
148 <<
"file: " << ioStream.
name()
150 <<
" From function " << functionName <<
nl
151 <<
" in file " << sourceFileName
152 <<
" at line " << sourceFileLineNumber <<
'.' <<
std::endl;
162 errDict.remove(
"type");
163 errDict.add(
"type",
word(
"Foam::IOerror"));
165 errDict.add(
"ioFileName", ioFileName());
166 errDict.add(
"ioStartLineNumber", ioStartLineNumber());
167 errDict.add(
"ioEndLineNumber", ioEndLineNumber());
183 if (
env(
"FOAM_ABORT"))
187 else if (throwExceptions_)
193 messageStreamPtr_->reset();
195 throw errorException;
200 <<
"\nFOAM parallel run exiting\n" <<
endl;
206 <<
"\nFOAM exiting\n" <<
endl;
220 if (
env(
"FOAM_ABORT"))
223 <<
"\nFOAM aborting (FOAM_ABORT set)\n" <<
endl;
227 else if (throwExceptions_)
233 messageStreamPtr_->reset();
235 throw errorException;
240 <<
"\nFOAM parallel run aborting\n" <<
endl;
247 <<
"\nFOAM aborting\n" <<
endl;
264 if (includeTitle && !title().empty())
266 os << title().c_str() <<
nl;
269 os << message().c_str() <<
nl <<
nl;
271 const bool hasFile = !ioFileName().empty();
275 os <<
"file: " << ioFileName().c_str();
277 if (ioStartLineNumber() >= 0)
279 if (ioStartLineNumber() < ioEndLineNumber())
281 os <<
" from line " << ioStartLineNumber()
282 <<
" to line " << ioEndLineNumber() <<
'.';
286 os <<
" at line " << ioStartLineNumber() <<
'.';
298 os <<
" From function " << functionName().c_str() <<
nl
299 <<
" in file " << sourceFileName().c_str()
300 <<
" at line " << sourceFileLineNumber() <<
'.';
void exit()
End with "termination=exit".
void abort()
Abort : used to stop code for fatal errors.
A class for handling words, derived from Foam::string.
static void exit(int errnum=1)
Exit program.
IOerror(const string &title)
Construct from title string.
static bool & parRun()
Is this a parallel run?
static int level
Controls the output verbosity of messageStream.
An IOstream is an abstract base class for all input/output systems; be they streams,...
Input/output from string buffers.
static void abort()
Abort program.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A class for handling character strings derived from std::string.
bool env(const std::string &envName)
True if environment variable of given name is defined.
static void SafeFatalIOError(const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream, const string &msg)
Print basic message and exit.
const fileName & name() const
The dictionary name.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual ~IOerror()
Destructor.
label startLineNumber() const
Return line number of first token in dictionary.
label endLineNumber() const
Return line number of last token in dictionary.
virtual const fileName & name() const
Return the name of the stream.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool bad() const
Return true if stream is corrupted.
errorManip< error > abort(error &err)
errorManipArg< error, int > exit(error &err, const int errNo=1)
OSstream & operator()()
Explicitly convert to OSstream for << operations.
prefixOSstream Perr
An Ostream wrapper for parallel output to std::cerr.
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
static bool constructed
Global value for constructed job info.
void write(Ostream &os, const bool includeTitle=true) const
Print error message.
label lineNumber() const
Const access to the current stream line number.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
void abort()
End with "termination=abort".
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.
Ostream & operator<<(Ostream &, const boundaryPatch &)