MediaException: Don't let untranslated default args shaddow translated error messages.
authorMichael Andres <ma@suse.de>
Thu, 19 Nov 2009 14:23:35 +0000 (15:23 +0100)
committerMichael Andres <ma@suse.de>
Thu, 19 Nov 2009 14:23:35 +0000 (15:23 +0100)
zypp/media/MediaCurl.cc
zypp/media/MediaException.cc
zypp/media/MediaException.h

index 3c57464..991d4a1 100644 (file)
@@ -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));
           }
index a906538..9cf3839 100644 (file)
@@ -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;
     }
 
   /////////////////////////////////////////////////////////////////
index a38e945..ffe02fc 100644 (file)
@@ -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)
       {}