- Fixed to allow more exact bad url error message
authorMarius Tomaschewski <mt@suse.de>
Mon, 13 Mar 2006 16:10:45 +0000 (16:10 +0000)
committerMarius Tomaschewski <mt@suse.de>
Mon, 13 Mar 2006 16:10:45 +0000 (16:10 +0000)
zypp/media/MediaCD.cc
zypp/media/MediaException.cc
zypp/media/MediaException.h

index e90462e..e8e091e 100644 (file)
@@ -106,7 +106,9 @@ namespace zypp {
              {
                ERR << "Device " << device << " is not acceptable "
                    << "for " << _url.getScheme() << std::endl;
-               ZYPP_THROW(MediaBadUrlEmptyDestinationException(_url));
+               ZYPP_THROW(MediaBadUrlException(_url,
+                 "Invalid device name in URL devices argument"
+               ));
              }
            }
            if (pos!=string::npos)
index 8c9df90..571dbf5 100644 (file)
@@ -93,7 +93,14 @@ namespace zypp
 
     std::ostream & MediaBadUrlException::dumpOn( std::ostream & str) const
     {
-      return str << "Malformed URL: " << _url << endl;
+      if( _msg.empty())
+      {
+       return str << "Malformed URL: " << _url << endl;
+      }
+      else
+      {
+       return str << _msg << ": " << _url << endl;
+      }
     }
 
     std::ostream & MediaBadUrlEmptyHostException::dumpOn( std::ostream & str) const
index 65384d0..fd3a986 100644 (file)
@@ -250,14 +250,17 @@ namespace zypp
     class MediaBadUrlException : public MediaException
     {
     public:
-      MediaBadUrlException(const Url & url_r)
+      MediaBadUrlException(const Url & url_r,
+                           const std::string &msg_r = std::string())
       : MediaException()
       , _url(url_r.asString())
+      , _msg(msg_r)
       {}
       virtual ~MediaBadUrlException() throw() {};
     protected:
       virtual std::ostream & dumpOn( std::ostream & str ) const;
       std::string _url;
+      std::string _msg;
     };
 
     class MediaBadUrlEmptyHostException : public MediaBadUrlException