69 template<
class EnumType>
class Enum;
77 public std::exception,
83 void exiting(
const int errNo,
const bool isAbort);
100 void simpleExit(
const int errNo,
const bool isAbort);
146 static
bool master(const
int communicator = -1);
261 void exit(
const int errNo = 1);
268 virtual void write(
Ostream&
os,
const bool withTitle =
true)
const;
301 label ioStartLineNumber_;
302 label ioEndLineNumber_;
308 void exiting(
const int errNo,
const bool isAbort);
322 explicit IOerror(
const dictionary& errDict);
340 return ioStartLineNumber_;
346 return ioEndLineNumber_;
392 const std::string& where,
402 const std::string& where,
416 const std::string& msg
426 void exit(
const int errNo = 1);
432 virtual void write(
Ostream&
os,
const bool withTitle =
true)
const;
466 #define FatalErrorIn(functionName) \ 467 ::Foam::FatalError((functionName), __FILE__, __LINE__) 471 #define FatalErrorInFunction FatalErrorIn(FUNCTION_NAME) 475 #define FatalErrorInLookup(lookupTag, lookupName, lookupTable) \ 476 ::Foam::FatalError(FUNCTION_NAME, __FILE__, __LINE__) \ 477 << "Unknown " << (lookupTag) << " type " << (lookupName) \ 478 << "\n\nValid " << (lookupTag) << " types :\n" \ 479 << ((lookupTable).sortedToc()) << '\n' 485 #define FatalIOErrorIn(functionName, ios) \ 486 ::Foam::FatalIOError((functionName), __FILE__, __LINE__, (ios)) 491 #define FatalIOErrorInFunction(ios) FatalIOErrorIn(FUNCTION_NAME, ios) 496 #define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable) \ 497 ::Foam::FatalIOError(FUNCTION_NAME, __FILE__, __LINE__, (ios)) \ 498 << "Unknown " << (lookupTag) << " type " << (lookupName) \ 499 << "\n\nValid " << (lookupTag) << " types :\n" \ 500 << ((lookupTable).sortedToc()) << '\n' 507 #define SafeFatalIOErrorIn(functionName, ios, msg) \ 508 ::Foam::IOerror::SafeFatalIOError \ 509 ((functionName), __FILE__, __LINE__, (ios), (msg)) 515 #define SafeFatalIOErrorInFunction(ios, msg) \ 516 SafeFatalIOErrorIn(FUNCTION_NAME, ios, msg) 525 #define notImplemented(functionName) \ 526 FatalErrorIn(functionName) \ 527 << "Not implemented" << ::Foam::abort(FatalError); 535 #define NotImplemented notImplemented(FUNCTION_NAME) const string & title() const noexcept
The title of this error type.
IOerror(const char *title)
Construct from title string.
Generic output stream using a standard (STL) stream.
void clear() const
Clear any accumulated error messages.
std::unique_ptr< OStringStream > messageStreamPtr_
handlerTypes
Handling of errors. The exact handling depends on the local context.
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.
static bool master(const int communicator=-1)
Like Pstream::master but with a Pstream::parRun guard in case Pstream has not yet been initialised...
Handle output messages in a simple, consistent stream-based manner.
Default behaviour (local meaning)
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.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
static void safePrintStack(std::ostream &os, int size=-1)
Helper function to print a stack, with optional upper limit. Used when OpenFOAM IO not yet initialise...
static bool useAbort()
True if FOAM_ABORT is on.
const string & functionName() const noexcept
The currently defined function name for output messages.
string message() const
The accumulated error message.
void abort()
Abort : used to stop code for fatal errors.
virtual void write(Ostream &os, const bool withTitle=true) const
Print error message.
Ignore on errors/problems.
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)
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.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
OSstream & stream()
Return OSstream for output operations.
int sourceFileLineNumber_
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 printStack(Ostream &os, int size=-1)
Helper function to print a stack, with optional upper limit.
int sourceFileLineNumber() const noexcept
The currently defined source-file line number for output messages.
static void SafeFatalIOError(const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream, const std::string &msg)
Print basic message and exit.
Fatal on errors/problems.
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
error(const char *title)
Construct from title string.
static const Enum< handlerTypes > handlerNames
Names of the error handler types.
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 ...