libyui  3.3.1
YUIException Class Reference

Base class for UI Exceptions. More...

#include <YUIException.h>

Inheritance diagram for YUIException:
Collaboration diagram for YUIException:

Public Member Functions

 YUIException ()
 Default constructor. More...
 
 YUIException (const std::string &msg_r)
 Constructor taking a message. More...
 
virtual ~YUIException () throw ()
 Destructor.
 
const YCodeLocationwhere () const
 Return YCodeLocation.
 
void relocate (const YCodeLocation &newLocation) const
 Exchange location on rethrow.
 
const std::string & msg () const
 Return the message string provided to the constructor. More...
 
void setMsg (const std::string &msg)
 Set a new message string.
 
std::string asString () const
 Error message provided by dumpOn as string.
 
virtual const char * what () const throw ()
 Return message string. More...
 

Static Public Member Functions

static std::string strErrno (int errno_r)
 Make a string from errno_r.
 
static std::string strErrno (int errno_r, const std::string &msg)
 Make a string from errno_r and msg_r.
 
static void log (const YUIException &exception, const YCodeLocation &location, const char *const prefix)
 Drop a log line on throw, catch or rethrow. More...
 

Protected Member Functions

virtual std::ostream & dumpOn (std::ostream &str) const
 Overload this to print a proper error message.
 

Friends

std::ostream & operator<< (std::ostream &str, const YUIException &obj)
 YUIException stream output.
 

Detailed Description

Base class for UI Exceptions.

Exception offers to store a message string passed to the constructor. Derived classes may provide additional information. Overload dumpOn to provide a proper error text.

Definition at line 297 of file YUIException.h.

Constructor & Destructor Documentation

◆ YUIException() [1/2]

YUIException::YUIException ( )

Default constructor.

Use YUI_THROW to throw exceptions.

Definition at line 62 of file YUIException.cc.

◆ YUIException() [2/2]

YUIException::YUIException ( const std::string &  msg_r)

Constructor taking a message.

Use YUI_THROW to throw exceptions.

Definition at line 67 of file YUIException.cc.

Member Function Documentation

◆ log()

void YUIException::log ( const YUIException exception,
const YCodeLocation location,
const char *const  prefix 
)
static

Drop a log line on throw, catch or rethrow.

Used by YUI_THROW macros.

Definition at line 127 of file YUIException.cc.

Here is the call graph for this function:

◆ msg()

const std::string& YUIException::msg ( ) const
inline

Return the message string provided to the constructor.

Note: This is not neccessarily the complete error message. The whole error message is provided by asString or dumpOn.

Definition at line 334 of file YUIException.h.

◆ what()

virtual const char* YUIException::what ( ) const
throw (
)
inlinevirtual

Return message string.

Reimplemented from std::exception.

Definition at line 370 of file YUIException.h.


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