IOerror Class Reference

Report an I/O error. More...

Inheritance diagram for IOerror:
[legend]
Collaboration diagram for IOerror:
[legend]

Public Member Functions

 IOerror (const string &title)
 Construct from title string. More...
 
 IOerror (const dictionary &errDict)
 Construct from dictionary. More...
 
virtual ~IOerror () noexcept
 Destructor. More...
 
const stringioFileName () const
 
label ioStartLineNumber () const
 
label ioEndLineNumber () const
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const string &ioFileName, const label ioStartLineNumber=-1, const label ioEndLineNumber=-1)
 Convert to OSstream. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream)
 Convert to OSstream. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const dictionary &dict)
 Convert to OSstream. More...
 
 operator dictionary () const
 Create and return a dictionary representation of the error. More...
 
void exit (const int errNo=1)
 Exit : can be called for any error to exit program. More...
 
void abort ()
 Abort : used to stop code for fatal errors. More...
 
void write (Ostream &os, const bool includeTitle=true) const
 Print error message. More...
 
- Public Member Functions inherited from error
 error (const string &title)
 Construct from title string. More...
 
 error (const dictionary &errDict)
 Construct from dictionary. More...
 
 error (const error &err)
 Copy construct. More...
 
virtual ~error () noexcept
 Destructor. More...
 
string message () const
 The accumulated error message. More...
 
void clear () const
 Clear any messages. More...
 
const stringfunctionName () const
 
const stringsourceFileName () const
 
label sourceFileLineNumber () const
 
bool throwing () const
 Return the current exception throwing (on or off) More...
 
bool throwExceptions (bool doThrow)
 Activate/deactivate exception throwing. More...
 
bool throwExceptions ()
 Activate exception throwing. More...
 
bool dontThrowExceptions ()
 Deactivate exception throwing. More...
 
OSstreamoperator() (const string &functionName)
 Define basic print message. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber=0)
 Define basic print message. More...
 
OSstreamoperator() (const string &functionName, const char *sourceFileName, const int sourceFileLineNumber=0)
 Define basic print message. More...
 
OSstreamoperator() ()
 Explicit convert to OSstream for << operations. More...
 
 operator OSstream & ()
 Convert to OSstream. More...
 
 operator dictionary () const
 Create and return a dictionary representation of the error. More...
 
void exit (const int errNo=1)
 Exit : can be called for any error to exit program. More...
 
void abort ()
 Abort : used to stop code for fatal errors. More...
 
void write (Ostream &os, const bool includeTitle=true) const
 Print error message. More...
 
- Public Member Functions inherited from messageStream
 messageStream (const string &title, const errorSeverity severity, const int maxErrors=0)
 Construct from components. More...
 
 messageStream (const dictionary &dict)
 Construct as Fatal from dictionary, extracting the 'title'. More...
 
const stringtitle () const
 The title of this error type. More...
 
int maxErrors () const
 The maximum number of errors before program termination. More...
 
int & maxErrors ()
 
OSstreammasterStream (const label communicator)
 Convert to OSstream. More...
 
OSstreamoperator() (const string &functionName)
 Print basic message. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber=0)
 Print basic message. More...
 
OSstreamoperator() (const string &functionName, const char *sourceFileName, const int sourceFileLineNumber=0)
 Print basic message. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const string &ioFileName, const label ioStartLineNumber=-1, const label ioEndLineNumber=-1)
 Print basic message. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &)
 Print basic message. More...
 
OSstreamoperator() (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const dictionary &)
 Print basic message. More...
 
 operator OSstream & ()
 Convert to OSstream for << operations. More...
 
OSstreamoperator() ()
 Explicitly convert to OSstream for << operations. More...
 

Static Public Member Functions

static void SafeFatalIOError (const char *functionName, const char *sourceFileName, const int sourceFileLineNumber, const IOstream &ioStream, const string &msg)
 Print basic message and exit. More...
 
- Static Public Member Functions inherited from error
static void warnAboutAge (const char *what, const int version)
 Emit warning on stderr about something being old. More...
 
static void safePrintStack (std::ostream &os)
 
static void printStack (Ostream &os)
 Helper function to print a stack. More...
 
static bool useAbort ()
 True if FOAM_ABORT is on. More...
 

Additional Inherited Members

- Public Types inherited from messageStream
enum  errorSeverity {
  INFO = 1, WARNING, SERIOUS, FATAL,
  INFO_STDERR = INFO | 0x10
}
 Message type, or error severity flags. More...
 
- Static Public Attributes inherited from messageStream
static int level
 The output level (verbosity) of messages. More...
 
static int redirect
 The output redirection of messages. More...
 
- Protected Attributes inherited from error
string functionName_
 
string sourceFileName_
 
label sourceFileLineNumber_
 
bool throwing_
 
std::unique_ptr< OStringStreammessageStreamPtr_
 
- Protected Attributes inherited from messageStream
string title_
 
errorSeverity severity_
 
int maxErrors_
 
int errorCount_
 

Detailed Description

Report an I/O error.

Definition at line 238 of file error.H.

Constructor & Destructor Documentation

◆ IOerror() [1/2]

IOerror ( const string title)
explicit

Construct from title string.

Definition at line 38 of file IOerror.C.

◆ IOerror() [2/2]

IOerror ( const dictionary errDict)
explicit

Construct from dictionary.

Definition at line 47 of file IOerror.C.

◆ ~IOerror()

~IOerror ( )
virtualnoexcept

Destructor.

Definition at line 58 of file IOerror.C.

Member Function Documentation

◆ ioFileName()

const string& ioFileName ( ) const
inline

Definition at line 272 of file error.H.

◆ ioStartLineNumber()

label ioStartLineNumber ( ) const
inline

Definition at line 277 of file error.H.

◆ ioEndLineNumber()

label ioEndLineNumber ( ) const
inline

Definition at line 282 of file error.H.

◆ operator()() [1/3]

Foam::OSstream & operator() ( const char *  functionName,
const char *  sourceFileName,
const int  sourceFileLineNumber,
const string ioFileName,
const label  ioStartLineNumber = -1,
const label  ioEndLineNumber = -1 
)

Convert to OSstream.

Prints basic message and returns OSstream for further info.

Definition at line 65 of file IOerror.C.

References error::operator()().

Here is the call graph for this function:

◆ operator()() [2/3]

Foam::OSstream & operator() ( const char *  functionName,
const char *  sourceFileName,
const int  sourceFileLineNumber,
const IOstream ioStream 
)

Convert to OSstream.

Prints basic message and returns OSstream for further info.

Definition at line 84 of file IOerror.C.

◆ operator()() [3/3]

Foam::OSstream & operator() ( const char *  functionName,
const char *  sourceFileName,
const int  sourceFileLineNumber,
const dictionary dict 
)

Convert to OSstream.

Prints basic message and returns OSstream for further info.

Definition at line 104 of file IOerror.C.

References dict, dictionary::endLineNumber(), dictionary::name(), and dictionary::startLineNumber().

Here is the call graph for this function:

◆ SafeFatalIOError()

void SafeFatalIOError ( const char *  functionName,
const char *  sourceFileName,
const int  sourceFileLineNumber,
const IOstream ioStream,
const string msg 
)
static

Print basic message and exit.

Uses cerr if streams not yet constructed (at startup). Use in startup parsing instead of FatalError.

Definition at line 124 of file IOerror.C.

References JobInfo::constructed, Foam::endl(), Foam::exit(), Foam::FatalIOError, IOstream::lineNumber(), IOstream::name(), and Foam::nl.

Here is the call graph for this function:

◆ operator dictionary()

operator dictionary ( ) const

Create and return a dictionary representation of the error.

◆ exit()

void exit ( const int  errNo = 1)

Exit : can be called for any error to exit program.

Definition at line 249 of file IOerror.C.

Referenced by Foam::exit(), IFstream::operator()(), and Istream::operator()().

Here is the caller graph for this function:

◆ abort()

void abort ( )

Abort : used to stop code for fatal errors.

Definition at line 255 of file IOerror.C.

Referenced by Foam::abort().

Here is the caller graph for this function:

◆ write()

void write ( Ostream os,
const bool  includeTitle = true 
) const

Print error message.

Definition at line 261 of file IOerror.C.

References Foam::foamVersion::api, IOstream::bad(), messageStream::level, Foam::nl, Foam::foamVersion::patch, and Foam::foamVersion::patched().

Referenced by Foam::operator<<().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: