MediaException.cc

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00013 #include <string>
00014 #include <iostream>
00015 
00016 #include "zypp/media/MediaException.h"
00017 
00018 using namespace std;
00019 
00021 namespace zypp
00022 { 
00023   namespace media {
00025 
00026     std::ostream & MediaMountException::dumpOn( std::ostream & str ) const
00027     {
00028       return str << "Failed to mount " << _source << " on " << _target
00029         << " : " << _error << endl;
00030     }
00031 
00032     std::ostream & MediaUnmountException::dumpOn( std::ostream & str ) const
00033     {
00034       return str << "Failed to unmount " << _path
00035         << " : " << _error << endl;
00036     }
00037 
00038     std::ostream & MediaBadFilenameException::dumpOn( std::ostream & str ) const
00039     {
00040       return str << "Bad file name " << _filename << endl;
00041     }
00042 
00043     std::ostream & MediaNotOpenException::dumpOn( std::ostream & str ) const
00044     {
00045       return str << "Media not opened while performing action " << _action << endl;
00046     }
00047 
00048     std::ostream & MediaFileNotFoundException::dumpOn( std::ostream & str) const
00049     {
00050       return str << "File " << _filename
00051         << " not found on media: " << _url << endl;
00052     }
00053 
00054     std::ostream & MediaWriteException::dumpOn( std::ostream & str) const
00055     {
00056       return str << "Cannot write file " << _filename << endl;
00057     }
00058 
00059     std::ostream & MediaNotAttachedException::dumpOn( std::ostream & str) const
00060     {
00061       return str << "Media not attached: " << _url << endl;
00062     }
00063 
00064     std::ostream & MediaBadAttachPointException::dumpOn( std::ostream & str) const
00065     {
00066       return str << "Bad media attach point: " << _url << endl;
00067     }
00068 
00069     std::ostream & MediaCurlInitException::dumpOn( std::ostream & str) const
00070     {
00071       return str << "Curl init failed for: " << _url << endl;
00072     }
00073 
00074     std::ostream & MediaSystemException::dumpOn( std::ostream & str) const
00075     {
00076       return str << "System exception: " << _message
00077         << " on media: " << _url << endl;
00078     }
00079 
00080     std::ostream & MediaNotAFileException::dumpOn( std::ostream & str) const
00081     {
00082       return str << "Path " << _path
00083         << " on media: " << _url
00084         << " is not a file." << endl;
00085     }
00086 
00087     std::ostream & MediaNotADirException::dumpOn( std::ostream & str) const
00088     {
00089       return str << "Path " << _path
00090         << " on media: " << _url
00091         << " is not a directory." << endl;
00092     }
00093 
00094     std::ostream & MediaBadUrlException::dumpOn( std::ostream & str) const
00095     {
00096       if( _msg.empty())
00097       {
00098         return str << "Malformed URL: " << _url << endl;
00099       }
00100       else
00101       {
00102         return str << _msg << ": " << _url << endl;
00103       }
00104     }
00105 
00106     std::ostream & MediaBadUrlEmptyHostException::dumpOn( std::ostream & str) const
00107     {
00108       return str << "Empty host name in URL: " << _url << endl;
00109     }
00110 
00111     std::ostream & MediaBadUrlEmptyFilesystemException::dumpOn( std::ostream & str) const
00112     {
00113       return str << "Empty filesystem in URL: " << _url << endl;
00114     }
00115 
00116     std::ostream & MediaBadUrlEmptyDestinationException::dumpOn( std::ostream & str) const
00117     {
00118       return str << "Empty destination in URL: " << _url << endl;
00119     }
00120 
00121     std::ostream & MediaUnsupportedUrlSchemeException::dumpOn( std::ostream & str) const
00122     {
00123       return str << "Unsupported URL scheme in URL: " << _url << endl;
00124     }
00125 
00126     std::ostream & MediaNotSupportedException::dumpOn( std::ostream & str) const
00127     {
00128       return str << "Operation not supported by media: " << _url << endl;
00129     }
00130 
00131     std::ostream & MediaCurlException::dumpOn( std::ostream & str) const
00132     {
00133       return str << "Curl error for: " << _url
00134         << ": Error code: " << _err
00135         << " Error message: " << _msg << endl;
00136     }
00137 
00138     std::ostream & MediaCurlSetOptException::dumpOn( std::ostream & str) const
00139     {
00140       return str << "Error occurred while setting CURL options for " << _url
00141         << ": " << _msg << endl;
00142     }
00143 
00144     std::ostream & MediaNotDesiredException::dumpOn( std::ostream & str ) const
00145     {
00146       return str << "Media source " << _url << " does not contain the desired media" << endl;
00147     }
00148 
00149     std::ostream & MediaIsSharedException::dumpOn( std::ostream & str ) const
00150     {
00151       return str << "Media " << _name << " is in use by another instance" << endl;
00152     }
00153 
00154     std::ostream & MediaNotEjectedException::dumpOn( std::ostream & str ) const
00155     {
00156       if( _name.empty())
00157         return str << "Can't eject any media" << endl;
00158       else
00159         return str << "Can't eject media " << _name << endl;
00160     }
00161 
00163   } // namespace media
00164 } // namespace zypp

Generated on Thu Jul 6 00:07:21 2006 for zypp by  doxygen 1.4.6