Go to the documentation of this file.
39 ioFileName_(
"unknown"),
40 ioStartLineNumber_(-1),
48 ioFileName_(errDict.
lookup(
"ioFileName")),
60 const char* functionName,
61 const char* sourceFileName,
62 const int sourceFileLineNumber,
63 const string& ioFileName,
64 const label ioStartLineNumber,
65 const label ioEndLineNumber
69 ioFileName_ = ioFileName;
70 ioStartLineNumber_ = ioStartLineNumber;
71 ioEndLineNumber_ = ioEndLineNumber;
79 const char* functionName,
80 const char* sourceFileName,
81 const int sourceFileLineNumber,
99 const char* functionName,
100 const char* sourceFileName,
101 const int sourceFileLineNumber,
109 sourceFileLineNumber,
119 const char* functionName,
120 const char* sourceFileName,
121 const int sourceFileLineNumber,
137 <<
"--> FOAM FATAL IO ERROR:" <<
std::endl
140 <<
"file: " << ioStream.
name()
141 <<
" at line " << ioStream.
lineNumber() <<
'.'
143 <<
" From function " << functionName
145 <<
" in file " << sourceFileName
146 <<
" at line " << sourceFileLineNumber <<
'.'
157 errDict.remove(
"type");
158 errDict.add(
"type",
word(
"Foam::IOerror"));
160 errDict.add(
"ioFileName", ioFileName());
161 errDict.add(
"ioStartLineNumber", ioStartLineNumber());
162 errDict.add(
"ioEndLineNumber", ioEndLineNumber());
176 if (
env(
"FOAM_ABORT"))
184 <<
"\nFOAM parallel run exiting\n" <<
endl;
189 if (throwExceptions_)
195 messageStreamPtr_->rewind();
197 throw errorException;
202 <<
"\nFOAM exiting\n" <<
endl;
217 if (
env(
"FOAM_ABORT"))
220 <<
"\nFOAM aborting (FOAM_ABORT set)\n" <<
endl;
228 <<
"\nFOAM parallel run aborting\n" <<
endl;
234 if (throwExceptions_)
240 messageStreamPtr_->rewind();
242 throw errorException;
247 <<
"\nFOAM aborting\n" <<
endl;
label ioEndLineNumber() const
const string & sourceFileName() const
bool env(const word &)
Return true if environment variable of given name is defined.
void abort()
Abort : used to stop code for fatal errors.
A class for handling words, derived from string.
const fileName & name() const
Return the dictionary name.
static void exit(int errnum=1)
Exit program.
IOerror(const string &title)
Construct from title string.
static bool & parRun()
Is this a parallel run?
prefixOSstream Perr(cerr, "Perr")
An IOstream is an abstract base class for all input/output systems; be they streams,...
label ioStartLineNumber() const
const string & functionName() const
static void abort()
Abort program.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const string & ioFileName() const
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.
static void SafeFatalIOError(const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &, const string &msg)
Print basic message and exit. Uses cerr if streams not constructed.
Ostream & operator<<(Ostream &, const edgeMesh &)
A list of keyword definitions, which are a keyword followed by any number of values (e....
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.
label sourceFileLineNumber() const
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
label readLabel(Istream &is)
const string & title() const
Return the title of this error type.
label lineNumber() const
Return current stream line number.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual const fileName & name() const
Return the name of the stream.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
stressControl lookup("compactNormalStress") >> compactNormalStress