INT << where_r << " " << prefix_r << " " << excpt_r << endl;
}
+ std::ostream & Exception::dumpOn( std::ostream & str ) const
+ {
+ return str << asString(); // fix it!
+ }
+
+ std::ostream & Exception::dumpError( std::ostream & str ) const
+ {
+ return dumpOn( str ); // fix it! prepend location info
+ }
+
std::ostream & operator<<( std::ostream & str, const Exception & obj )
- { return str << obj.asString(); }
+ { return obj.dumpError( str ); }
/////////////////////////////////////////////////////////////////
} // namespace zypp
class Exception : public std::exception
{
friend std::ostream & operator<<( std::ostream & str, const Exception & obj );
+
public:
typedef exception_detail::CodeLocation CodeLocation;
/** Exception as string */
std::string asString() const;
+ protected:
+
+ /** Overload this to print a proper error message.
+ * CodeLocation is prepended automatically.
+ */
+ virtual std::ostream & dumpOn( std::ostream & str ) const;
+
public:
/** Make a string from \a errno_r. */
static std::string strErrno( int errno_r );
private:
mutable CodeLocation _where;
std::string _msg;
+
+ /** Called by <tt>std::ostream & operator\<\<</tt> */
+ std::ostream & dumpError( std::ostream & str ) const;
};
///////////////////////////////////////////////////////////////////