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,
102 ioStream.relativeName(),
103 ioStream.lineNumber(),
111 const char* functionName,
112 const char* sourceFileName,
113 const int sourceFileLineNumber,
121 sourceFileLineNumber,
131 const std::string& where,
140 ioStream.relativeName(),
141 ioStream.lineNumber(),
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());
215void 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 <<
'.';
Input/output from string buffers.
virtual ~IOerror() noexcept
Destructor.
virtual void write(Ostream &os, const bool withTitle=true) const
Print error message.
static void SafeFatalIOError(const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream, const string &msg)
Print basic message and exit.
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 noexcept
Const access to the current stream line number.
bool bad() const noexcept
True if stream is corrupted.
fileName relativeName() const
Return the name of the stream relative to the current case.
void exit()
Job end with "exit" termination.
static void shutdown()
Simple shutdown (finalize) of JobInfo.
static bool constructed
Global value for constructed job info.
Generic output stream using a standard (STL) stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
fileName relativeName(const bool caseTag=false) const
The dictionary name relative to the case.
label endLineNumber() const
Return line number of last token in dictionary.
entry * add(entry *entryPtr, 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.
static bool useAbort()
True if FOAM_ABORT is on.
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
virtual bool write()
Write the output fields.
static int level
The output level (verbosity) of messages.
A class for handling character strings derived from std::string.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
const std::string patch
OpenFOAM patch number as a std::string.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)