#include <sstream>
#include "zypp/base/Logger.h"
+#include "zypp/base/Gettext.h"
#include "zypp/base/String.h"
#include "zypp/base/Exception.h"
return str.str();
}
+ std::string Exception::asUserString() const
+ {
+ std::ostringstream str;
+ dumpOn( str );
+ return _(str.str().c_str());
+ }
+
+
std::ostream & Exception::dumpOn( std::ostream & str ) const
{ return str << _msg; }
/** Error message provided by \ref dumpOn as string. */
std::string asString() const;
- std::string asTranslatedString() const { return asString(); }
+ /** Translated error message as string suitable for the user. */
+ std::string asUserString() const;
+
protected:
/** Overload this to print a proper error message. */
ZYPP_THROW( EXCPTTYPE( ::zypp::Exception::strErrno(ERRNO,MSG) ) )
//@}
+#define ZYPP_DUMPON(msg) ( translated ? _(msg) : msg )
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
rpm::InstallResolvableReport::Action user =
_report->problem( _resolvable
, rpm::InstallResolvableReport::INVALID
- , excpt_r.msg()
+ , excpt_r.asUserString()
, _level
);
rpm::RemoveResolvableReport::Action user =
_report->problem( _resolvable
, rpm::RemoveResolvableReport::INVALID
- , excpt_r.msg()
+ , excpt_r.asUserString()
);
switch (user) {
}
catch (RpmException & excpt_r)
{
- report->finish(root() + dbPath(), RebuildDBReport::FAILED, excpt_r.msg());
+ report->finish(root() + dbPath(), RebuildDBReport::FAILED, excpt_r.asUserString());
ZYPP_RETHROW(excpt_r);
}
report->finish(root() + dbPath(), RebuildDBReport::NO_ERROR, "");
}
catch (RpmException & excpt_r)
{
- report->finish(ScanDBReport::FAILED, excpt_r.msg ());
+ report->finish(ScanDBReport::FAILED, excpt_r.asUserString ());
ZYPP_RETHROW(excpt_r);
}
#warning fixme
}
catch (RpmException & excpt_r)
{
- report->finish(v3db_r, ConvertDBReport::FAILED,excpt_r.msg());
+ report->finish(v3db_r, ConvertDBReport::FAILED,excpt_r.asUserString());
ZYPP_RETHROW(excpt_r);
}
report->finish(v3db_r, ConvertDBReport::NO_ERROR, "");