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 " virtual std::ostream & dumpOn(std::ostream &str) const
Write proper error message with all relevant data.
YProperty property() const
Returns the property that caused this exception.
virtual ~YUIException()
Destructor.
std::string asString() const
Error message provided by dumpOn as string.
YPropertyType type() const
Return the property type the application tried to set.
int line() const
Returns the source line number where the exception occured.
virtual std::ostream & dumpOn(std::ostream &str) const
Write proper error message with all relevant data.
std::string asString() const
Returns the location in normalized string format.
static std::string strErrno(int errno_r)
Make a string from errno_r.
std::string typeAsStr() const
Returns the type of this property as string.
std::string name() const
Returns the name of this property.
std::string func() const
Returns the name of the function where the exception occured.
std::string file() const
Returns the source file name where the exception occured.
virtual std::ostream & dumpOn(std::ostream &str) const
Write proper error message with all relevant data.
YUIException()
Default constructor.
Helper class for UI exceptions: Store FILE, FUNCTION and LINE.
const std::string & msg() const
Return the message string provided to the constructor.
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.
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
Base class for UI Exceptions.
YWidget * widget() const
Returns the corresponding widget or 0 if there was none.