32 #define YUILogComponent "ui"
35 #include "YUIException.h"
45 str +=
"(" + _func +
"):";
47 char formatted_number[ 20 ];
48 sprintf( formatted_number,
"%u", _line );
50 str += formatted_number;
84 std::ostringstream str;
98 YUIException::dumpError( ostream & str )
const
100 return dumpOn( str << _where <<
": " );
107 return obj.dumpError( str );
114 return strerror( errno_r );
130 const char *
const prefix )
132 YUILog::warning( YUILogComponent,
133 location.
file().c_str(),
135 location.
func().c_str() )
136 <<
"\t" << prefix <<
" " << exception.
asString() << endl;
146 <<
" has no property named \""
153 return str <<
"Unknown property name \""
167 widgetClass = string(
widget()->widgetClass() ) +
"::";
169 return str <<
"Property type mismatch: "
186 widgetClass = string(
widget()->widgetClass() ) +
"::";
188 return str <<
"Property "
202 widgetClass = string(
widget()->widgetClass() ) +
"::";
204 return str <<
"Bad argument for property "
YUIException()
Default constructor.
std::string func() const
Returns the name of the function where the exception occured.
YPropertyType type() const
Return the property type the application tried to set.
virtual ~YUIException()
Destructor.
YWidget * widget() const
Returns the corresponding widget or 0 if there was none.
std::string asString() const
Error message provided by dumpOn as string.
virtual std::ostream & dumpOn(std::ostream &str) const
Write proper error message with all relevant data.
static void log(const YUIException &exception, const YCodeLocation &location, const char *const prefix)
Drop a log line on throw, catch or rethrow.
YProperty property() const
Returns the property that caused this exception.
std::string file() const
Returns the source file name where the exception occured.
std::string asString() const
Returns the location in normalized string format.
std::string typeAsStr() const
Returns the type of this property as string.
virtual std::ostream & dumpOn(std::ostream &str) const
Write proper error message with all relevant data.
Helper class for UI exceptions: Store FILE, FUNCTION and LINE.
std::string name() const
Returns the name of this property.
virtual std::ostream & dumpOn(std::ostream &str) const
Write proper error message with all relevant data.
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
virtual std::ostream & dumpOn(std::ostream &str) const
Write proper error message with all relevant data.
static std::string strErrno(int errno_r)
Make a string from errno_r.
const std::string & msg() const
Return the message string provided to the constructor.
int line() const
Returns the source line number where the exception occured.
Base class for UI Exceptions.