Go to the documentation of this file.
76 public std::exception,
82 void exiting(
const int errNo,
const bool isAbort);
99 void simpleExit(
const int errNo,
const bool isAbort);
117 virtual ~error() noexcept;
127 static
bool master(const label communicator = -1);
177 bool throwing(
const bool on) noexcept
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);
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)
static void printStack(Ostream &os)
Helper function to print a stack.
std::unique_ptr< OStringStream > messageStreamPtr_
void abort()
Abort : used to stop code for fatal errors.
label ioEndLineNumber() const noexcept
The currently defined IO end-line number.
Handle output messages in a simple, consistent stream-based manner.
bool dontThrowExceptions() noexcept
Deactivate exception throwing.
IOerror(const string &title)
Construct from title string.
An IOstream is an abstract base class for all input/output systems; be they streams,...
bool throwing() const noexcept
Return the current exception throwing state (on or off)
#define SafeFatalIOErrorIn(functionName, ios, msg)
Report an error message using Foam::FatalIOError.
const string & functionName() const noexcept
The currently defined function name for output messages.
label sourceFileLineNumber() const noexcept
The currently defined source-file line number for output messages.
label ioStartLineNumber() const noexcept
The currently defined IO start-line number for output messages.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
static void SafeFatalIOError(const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream, const string &msg)
Print basic message and exit.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
error(const string &title)
Construct from title string.
bool throwExceptions(const bool on=true) noexcept
Specify exception throwing state (default is on)
#define notImplemented(functionName)
Issue a FatalErrorIn for a function not currently implemented.
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
Generic output stream using a standard (STL) stream.
virtual ~IOerror() noexcept
Destructor.
#define SafeFatalIOErrorInFunction(ios, msg)
Report an error message using Foam::FatalIOError.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
string message() const
The accumulated error message.
label sourceFileLineNumber_
static bool useAbort()
True if FOAM_ABORT is on.
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
OSstream & operator()()
Explicit convert to OSstream for << operations.
virtual ~error() noexcept
Destructor.
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.
OSstream & stream()
Return OSstream for output operations.
virtual void write(Ostream &os, const bool withTitle=true) const
Print error message.
void abort()
Abort : used to stop code for fatal errors.
static bool master(const label communicator=-1)
void simpleExit(const int errNo, const bool isAbort)
Exit or abort, without throwing or job control handling.
void clear() const
Clear any messages.
static bool warnAboutAge(const int version) noexcept
Test if an age warning should be emitted.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual void write(Ostream &os, const bool withTitle=true) const
Print error message.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
const string & title() const noexcept
The title of this error type.
static void safePrintStack(std::ostream &os)
const string & sourceFileName() const noexcept
The currently defined source-file name for output messages.