1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/media/MediaException.h
12 #ifndef ZYPP_MEDIA_MEDIAEXCEPTION_H
13 #define ZYPP_MEDIA_MEDIAEXCEPTION_H
19 #include "zypp/base/Exception.h"
20 #include "zypp/Pathname.h"
23 ///////////////////////////////////////////////////////////////////
25 { /////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////
29 // CLASS NAME : MediaException
30 /** Just inherits Exception to separate media exceptions
33 class MediaException : public Exception
36 /** Ctor taking message.
37 * Use \ref ZYPP_THROW to throw exceptions.
40 : Exception( "Media Exception" )
42 /** Ctor taking message.
43 * Use \ref ZYPP_THROW to throw exceptions.
45 MediaException( const std::string & msg_r )
49 virtual ~MediaException() throw() {};
52 class MediaMountException : public MediaException
55 /** Ctor taking message.
56 * Use \ref ZYPP_THROW to throw exceptions.
58 MediaMountException( const std::string & error_r,
59 const std::string & source_r,
60 const std::string & target_r )
67 virtual ~MediaMountException() throw() {};
69 virtual std::ostream & dumpOn( std::ostream & str ) const;
76 class MediaUnmountException : public MediaException
79 /** Ctor taking message.
80 * Use \ref ZYPP_THROW to throw exceptions.
82 MediaUnmountException( const std::string & error_r,
83 const std::string & path_r )
89 virtual ~MediaUnmountException() throw() {};
91 virtual std::ostream & dumpOn( std::ostream & str ) const;
97 class MediaBadFilenameException : public MediaException
100 MediaBadFilenameException(const std::string & filename_r)
102 , _filename(filename_r)
104 virtual ~MediaBadFilenameException() throw() {};
105 std::string filename() const { return _filename; }
107 virtual std::ostream & dumpOn( std::ostream & str ) const;
109 std::string _filename;
112 class MediaNotOpenException : public MediaException
115 MediaNotOpenException()
118 virtual ~MediaNotOpenException() throw() {};
120 virtual std::ostream & dumpOn( std::ostream & str ) const;
124 class MediaFileNotFoundException : public MediaException
127 MediaFileNotFoundException(const Url & url_r,
128 const Pathname & filename_r)
130 , _url(url_r.toString())
131 , _filename(filename_r.asString())
133 virtual ~MediaFileNotFoundException() throw() {};
135 virtual std::ostream & dumpOn( std::ostream & str ) const;
138 std::string _filename;
141 class MediaWriteException : public MediaException
144 MediaWriteException(const Pathname & filename_r)
146 , _filename(filename_r.asString())
148 virtual ~MediaWriteException() throw() {};
150 virtual std::ostream & dumpOn( std::ostream & str ) const;
152 std::string _filename;
155 class MediaNotAttachedException : public MediaException
158 MediaNotAttachedException(const Url & url_r)
160 , _url(url_r.toString())
162 virtual ~MediaNotAttachedException() throw() {};
164 virtual std::ostream & dumpOn( std::ostream & str ) const;
169 class MediaSystemException : public MediaException
172 MediaSystemException(const Url & url_r,
173 const std::string & message_r)
175 , _url(url_r.toString())
176 , _message(message_r)
178 virtual ~MediaSystemException() throw() {};
180 virtual std::ostream & dumpOn( std::ostream & str ) const;
183 std::string _message;
186 class MediaNotAFileException : public MediaException
189 MediaNotAFileException(const Url & url_r,
190 const Pathname & path_r)
192 , _url(url_r.toString())
193 , _path(path_r.asString())
195 virtual ~MediaNotAFileException() throw() {};
197 virtual std::ostream & dumpOn( std::ostream & str ) const;
203 class MediaNotADirException : public MediaException
206 MediaNotADirException(const Url & url_r,
207 const Pathname & path_r)
209 , _url(url_r.toString())
210 , _path(path_r.asString())
212 virtual ~MediaNotADirException() throw() {};
214 virtual std::ostream & dumpOn( std::ostream & str ) const;
220 class MediaBadUrlException : public MediaException
223 MediaBadUrlException(const Url & url_r)
225 , _url(url_r.toString())
227 virtual ~MediaBadUrlException() throw() {};
229 virtual std::ostream & dumpOn( std::ostream & str ) const;
236 /////////////////////////////////////////////////////////////////
239 ///////////////////////////////////////////////////////////////////
240 #endif // ZYPP_MEDIA_MEDIAEXCEPTION_H