case 504: // gateway timeout
ZYPP_THROW(MediaTimeoutException(url));
case 403:
- {
+ {
string msg403;
if (url.asString().find("novell.com") != string::npos)
- msg403 = str::form(_(
- "Permission to access '%s' denied.\n\n"
- "Visit the Novell Customer Center to check whether"
- " your registration is valid and has not expired."),
- url.asString().c_str());
-
+ msg403 = _("Visit the Novell Customer Center to check whether your registration is valid and has not expired.");
ZYPP_THROW(MediaForbiddenException(url, msg403));
- }
+ }
case 404:
ZYPP_THROW(MediaFileNotFoundException(_url, filename));
}
std::ostream & MediaForbiddenException::dumpOn( std::ostream & str ) const
{
- if (_msg.empty())
- return str << form(_("Permission to access '%s' denied."), _url.c_str()) << endl;
- return str << _msg << endl;
+ str << form(_("Permission to access '%s' denied."), _url.c_str()) << endl;
+ if ( !_msg.empty() )
+ str << endl << _msg << endl;
+ return str;
}
std::ostream & MediaTimeoutException::dumpOn( std::ostream & str ) const
{
- if (_msg.empty())
- return str << form(_("Timeout exceeded when access '%s'."), _url.c_str()) << endl;
- return str << _msg << endl;
+ str << form(_("Timeout exceeded when accessing '%s'."), _url.c_str()) << endl;
+ if ( !_msg.empty() )
+ str << endl << _msg << endl;
+ return str;
}
std::ostream & MediaTemporaryProblemException::dumpOn( std::ostream & str ) const
{
- if (_msg.empty())
- return str << form(_("Location '%s' is temporarily unaccessible."), _url.c_str()) << endl;
- return str << _msg << endl;
+ str << form(_("Location '%s' is temporarily unaccessible."), _url.c_str()) << endl;
+ if ( !_msg.empty() )
+ str << endl << _msg << endl;
+ return str;
}
std::ostream & MediaBadCAException::dumpOn( std::ostream & str ) const
{
- if (_msg.empty())
- return str << form(_(" SSL certificate problem, verify that the CA cert is OK for '%s'."), _url.c_str()) << endl;
- return str << _msg << endl;
+ str << form(_(" SSL certificate problem, verify that the CA cert is OK for '%s'."), _url.c_str()) << endl;
+ if ( !_msg.empty() )
+ str << endl << _msg << endl;
+ return str;
}
std::ostream & MediaNoLoopDeviceException::dumpOn( std::ostream & str ) const
{
- if (msg().empty())
- return str << form(_("Cannot find available loop device to mount the image file from '%s'"), _url.c_str()) << endl;
- return str << msg() << endl;
+ str << form(_("Cannot find available loop device to mount the image file from '%s'"), _url.c_str()) << endl;
+ if ( !_msg.empty() )
+ str << endl << _msg << endl;
+ return str;
}
/////////////////////////////////////////////////////////////////
class MediaTimeoutException : public MediaException
{
public:
- MediaTimeoutException(const Url & url_r, const std::string & msg = "Timeout exceed")
+ MediaTimeoutException(const Url & url_r, const std::string & msg = "")
: MediaException(msg)
, _url(url_r.asString()), _msg(msg)
{}
class MediaTemporaryProblemException : public MediaException
{
public:
- MediaTemporaryProblemException(const Url & url_r, const std::string & msg = "Temporary problem")
+ MediaTemporaryProblemException(const Url & url_r, const std::string & msg = "")
: MediaException(msg)
, _url(url_r.asString()), _msg(msg)
{}
class MediaBadCAException : public MediaException
{
public:
- MediaBadCAException(const Url & url_r, const std::string & msg = "Invalid CA")
+ MediaBadCAException(const Url & url_r, const std::string & msg = "")
: MediaException(msg)
, _url(url_r.asString()), _msg(msg)
{}