76 public std::exception,
82 void exiting(
const int errNo,
const bool isAbort);
99 void simpleExit(
const int errNo,
const bool isAbort);
127 static
bool master(const label communicator = -1);
247 void exit(
const int errNo = 1);
254 virtual void write(
Ostream&
os,
const bool withTitle =
true)
const;
287 label ioStartLineNumber_;
288 label ioEndLineNumber_;
294 void exiting(
const int errNo,
const bool isAbort);
305 explicit IOerror(
const dictionary& errDict);
323 return ioStartLineNumber_;
329 return ioEndLineNumber_;
375 const std::string& where,
385 const std::string& where,
409 void exit(
const int errNo = 1);
415 virtual void write(
Ostream&
os,
const bool withTitle =
true)
const;
449 #define FatalErrorIn(functionName) \ 450 ::Foam::FatalError((functionName), __FILE__, __LINE__) 454 #define FatalErrorInFunction FatalErrorIn(FUNCTION_NAME) 458 #define FatalErrorInLookup(lookupTag, lookupName, lookupTable) \ 459 ::Foam::FatalError(FUNCTION_NAME, __FILE__, __LINE__) \ 460 << "Unknown " << (lookupTag) << " type " << (lookupName) \ 461 << "\n\nValid " << (lookupTag) << " types :\n" \ 462 << ((lookupTable).sortedToc()) << '\n' 468 #define FatalIOErrorIn(functionName, ios) \ 469 ::Foam::FatalIOError((functionName), __FILE__, __LINE__, (ios)) 474 #define FatalIOErrorInFunction(ios) FatalIOErrorIn(FUNCTION_NAME, ios) 479 #define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable) \ 480 ::Foam::FatalIOError(FUNCTION_NAME, __FILE__, __LINE__, (ios)) \ 481 << "Unknown " << (lookupTag) << " type " << (lookupName) \ 482 << "\n\nValid " << (lookupTag) << " types :\n" \ 483 << ((lookupTable).sortedToc()) << '\n' 490 #define SafeFatalIOErrorIn(functionName, ios, msg) \ 491 ::Foam::IOerror::SafeFatalIOError \ 492 ((functionName), __FILE__, __LINE__, (ios), (msg)) 498 #define SafeFatalIOErrorInFunction(ios, msg) \ 499 SafeFatalIOErrorIn(FUNCTION_NAME, ios, msg) 508 #define notImplemented(functionName) \ 509 FatalErrorIn(functionName) \ 510 << "Not implemented" << ::Foam::abort(FatalError); 518 #define NotImplemented notImplemented(FUNCTION_NAME) const string & title() const noexcept
The title of this error type.
Generic output stream using a standard (STL) stream.
IOerror(const string &title)
Construct from title string.
void clear() const
Clear any messages.
std::unique_ptr< OStringStream > messageStreamPtr_
void abort()
Abort : used to stop code for fatal errors.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
virtual ~IOerror() noexcept
Destructor.
bool throwing() const noexcept
Return the current exception throwing state (on or off)
bool dontThrowExceptions() noexcept
Deactivate exception throwing.
virtual ~error() noexcept
Destructor.
Handle output messages in a simple, consistent stream-based manner.
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
static bool warnAboutAge(const int version) noexcept
Test if an age warning should be emitted.
error(const string &title)
Construct from title string.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
label sourceFileLineNumber_
static bool useAbort()
True if FOAM_ABORT is on.
static bool master(const label communicator=-1)
Like Pstream::master but with a Pstream::parRun guard in case Pstream has not yet been initialised...
const string & functionName() const noexcept
The currently defined function name for output messages.
string message() const
The accumulated error message.
static void printStack(Ostream &os)
Helper function to print a stack.
void abort()
Abort : used to stop code for fatal errors.
virtual void write(Ostream &os, const bool withTitle=true) const
Print error message.
label sourceFileLineNumber() const noexcept
The currently defined source-file line number for output messages.
bool throwExceptions(const bool on=true) noexcept
Specify exception throwing state (default is on)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
const string & ioFileName() const noexcept
The currently defined IO name for output messages.
label ioStartLineNumber() const noexcept
The currently defined IO start-line number for output messages.
OBJstream os(runTime.globalPath()/outputName)
OSstream & operator()()
Explicit convert to OSstream for << operations.
virtual void write(Ostream &os, const bool withTitle=true) const
Print error message.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
static void safePrintStack(std::ostream &os)
Helper function to print a stack, used when OpenFOAM IO not yet initialised.
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc.
OSstream & stream()
Return OSstream for output operations.
const string & sourceFileName() const noexcept
The currently defined source-file name for output messages.
label ioEndLineNumber() const noexcept
The currently defined IO end-line number.
static void SafeFatalIOError(const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream, const string &msg)
Print basic message and exit.
void simpleExit(const int errNo, const bool isAbort)
Exit or abort, without throwing or job control handling.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...