38 ioFileName_(
"unknown"),
39 ioStartLineNumber_(-1),
47 const char* sourceFileName,
48 const int sourceFileLineNumber,
49 const string& ioFileName,
50 const label ioStartLineNumber,
51 const label ioEndLineNumber
56 ioFileName_ = ioFileName;
57 ioStartLineNumber_ = ioStartLineNumber;
58 ioEndLineNumber_ = ioEndLineNumber;
67 const char* sourceFileName,
68 const int sourceFileLineNumber,
78 ioStream.lineNumber(),
87 const char* sourceFileName,
88 const int sourceFileLineNumber,
107 const char* sourceFileName,
108 const int sourceFileLineNumber,
119 sourceFileLineNumber,
127 <<
"--> FOAM FATAL IO ERROR:" <<
std::endl
130 <<
"file: " << ioStream.
name()
131 <<
" at line " << ioStream.
lineNumber() <<
'.'
135 <<
" in file " << sourceFileName
136 <<
" at line " << sourceFileLineNumber <<
'.'
147 errDict.remove(
"type");
148 errDict.add(
"type",
word(
"Foam::IOerror"));
150 errDict.add(
"ioFileName", ioFileName());
151 errDict.add(
"ioStartLineNumber", ioStartLineNumber());
152 errDict.add(
"ioEndLineNumber", ioEndLineNumber());
174 <<
"\nFOAM parallel run exiting\n" <<
endl;
179 if (throwExceptions_)
185 messageStream_.rewind();
187 throw errorException;
192 <<
"\nFOAM exiting\n" <<
endl;
210 <<
"\nFOAM aborting (FOAM_ABORT set)\n" <<
endl;
218 <<
"\nFOAM parallel run aborting\n" <<
endl;
224 if (throwExceptions_)
230 messageStream_.rewind();
232 throw errorException;
237 <<
"\nFOAM aborting\n" <<
endl;
const string & ioFileName() const
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.
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
label ioEndLineNumber() const
IOerror(const string &title)
Construct from title string.
label ioStartLineNumber() const
void abort()
Abort : used to stop code for fatal errors.
An IOstream is an abstract base class for all input/output systems; be they streams,...
label lineNumber() const
Return current stream line number.
virtual const fileName & name() const
Return the name of the stream.
bool bad() const
Return true if stream is corrupted.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static void abort()
Abort program.
static bool & parRun()
Is this a parallel run?
static void exit(int errnum=1)
Exit program.
const fileName & name() const
Return the dictionary name.
A list of keyword definitions, which are a keyword followed by any number of values (e....
label endLineNumber() const
Return line number of last token in dictionary.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
label startLineNumber() const
Return line number of first token in dictionary.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
const string & sourceFileName() const
const string & functionName() const
OSstream & operator()()
Explicitly convert to OSstream for << operations.
label sourceFileLineNumber() const
A functionName is a word starting with '#'.
const string & title() const
Return the title of this error type.
A class for handling words, derived from string.
errorManipArg< error, int > exit(error &err, const int errNo=1)
prefixOSstream Perr(cerr, "Perr")
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
Ostream & operator<<(Ostream &, const ensightPart &)