32 #define YUILogComponent "ui" 35 #include "YUIException.h" 43 std::string str( _file );
44 str +=
"(" + _func +
"):";
46 char formatted_number[ 20 ];
47 sprintf( formatted_number,
"%u", _line );
49 str += formatted_number;
83 std::ostringstream str;
97 YUIException::dumpError( std::ostream & str )
const 99 return dumpOn( str << _where <<
": " );
106 return obj.dumpError( str );
113 return strerror( errno_r );
120 std::string ret( msg );
129 const char *
const prefix )
131 YUILog::warning( YUILogComponent,
132 location.
file().c_str(),
134 location.
func().c_str() )
135 <<
"\t" << prefix <<
" " << exception.
asString() << std::endl;
144 return str << widget()->widgetClass()
145 <<
" has no property named \"" 152 return str <<
"Unknown property name \"" 163 std::string widgetClass;
166 widgetClass = std::string( widget()->widgetClass() ) +
"::";
168 return str <<
"Property type mismatch: " 172 << property().typeAsStr()
182 std::string widgetClass;
185 widgetClass = std::string( widget()->widgetClass() ) +
"::";
187 return str <<
"Property " 198 std::string widgetClass;
201 widgetClass = std::string( widget()->widgetClass() ) +
"::";
203 return str <<
"Bad argument for property " virtual ~YUIException()
Destructor.
virtual std::ostream & dumpOn(std::ostream &str) const
Write proper error message with all relevant data.
virtual std::ostream & dumpOn(std::ostream &str) const
Write proper error message with all relevant data.
int line() const
Returns the source line number where the exception occured.
virtual std::ostream & dumpOn(std::ostream &str) const
Overload this to print a proper error message.
std::string asString() const
Error message provided by dumpOn as string.
std::string typeAsStr() const
Returns the type of this property as string.
friend std::ostream & operator<<(std::ostream &str, const YCodeLocation &obj)
Stream output.
friend std::ostream & operator<<(std::ostream &str, const YUIException &obj)
YUIException stream output.
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.
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.
static void log(const YUIException &exception, const YCodeLocation &location, const char *const prefix)
Drop a log line on throw, catch or rethrow.
static std::string strErrno(int errno_r)
Make a string from errno_r.
std::string asString() const
Returns the location in normalized string format.
Base class for UI Exceptions.
virtual std::ostream & dumpOn(std::ostream &str) const
Write proper error message with all relevant data.
virtual std::ostream & dumpOn(std::ostream &str) const
Write proper error message with all relevant data.