Mailinglist Archive: zypp-commit (233 mails)

< Previous Next >
[zypp-commit] <libzypp> master : MediaException: Don't let untranslated default args shaddow translated error messages.
  • From: Michael Andres <ma@xxxxxxx>
  • Date: Thu, 19 Nov 2009 15:23:35 +0100
  • Message-id: <E1NB7vA-0000W7-BO@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 2dffebf9fe40c416121ae541bc5d10bde0a315d5
Author: Michael Andres <ma@xxxxxxx>
Date: Thu Nov 19 15:23:35 2009 +0100

MediaException: Don't let untranslated default args shaddow translated
error messages.
---
zypp/media/MediaCurl.cc | 11 +++--------
zypp/media/MediaException.cc | 35 ++++++++++++++++++++---------------
zypp/media/MediaException.h | 6 +++---
3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/zypp/media/MediaCurl.cc b/zypp/media/MediaCurl.cc
index 3c57464..991d4a1 100644
--- a/zypp/media/MediaCurl.cc
+++ b/zypp/media/MediaCurl.cc
@@ -858,17 +858,12 @@ void MediaCurl::evaluateCurlCode( const Pathname
&filename,
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));
}
diff --git a/zypp/media/MediaException.cc b/zypp/media/MediaException.cc
index a906538..9cf3839 100644
--- a/zypp/media/MediaException.cc
+++ b/zypp/media/MediaException.cc
@@ -248,37 +248,42 @@ namespace zypp

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;
}

/////////////////////////////////////////////////////////////////
diff --git a/zypp/media/MediaException.h b/zypp/media/MediaException.h
index a38e945..ffe02fc 100644
--- a/zypp/media/MediaException.h
+++ b/zypp/media/MediaException.h
@@ -570,7 +570,7 @@ class MediaAria2cInitException : public MediaException
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)
{}
@@ -585,7 +585,7 @@ class MediaAria2cInitException : public MediaException
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)
{}
@@ -599,7 +599,7 @@ class MediaAria2cInitException : public MediaException
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)
{}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages