- Removed MediaNr, handled completely by source.
[platform/upstream/libzypp.git] / zypp / media / MediaException.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/media/MediaException.cc
10  *
11 */
12
13 #include <string>
14 #include <iostream>
15
16 #include "zypp/media/MediaException.h"
17
18 using namespace std;
19
20 ///////////////////////////////////////////////////////////////////
21 namespace zypp
22 { /////////////////////////////////////////////////////////////////
23   namespace media {
24   /////////////////////////////////////////////////////////////////
25
26     std::ostream & MediaMountException::dumpOn( std::ostream & str ) const
27     {
28       return str << "Failed to mount " << _source << " on " << _target
29         << " : " << _error << endl;
30     }
31
32     std::ostream & MediaUnmountException::dumpOn( std::ostream & str ) const
33     {
34       return str << "Failed to unmount " << _path
35         << " : " << _error << endl;
36     }
37
38     std::ostream & MediaBadFilenameException::dumpOn( std::ostream & str ) const
39     {
40       return str << "Bad file name " << _filename << endl;
41     }
42
43     std::ostream & MediaNotOpenException::dumpOn( std::ostream & str ) const
44     {
45       return str << "Media not opened while performing action " << _action << endl;
46     }
47
48     std::ostream & MediaFileNotFoundException::dumpOn( std::ostream & str) const
49     {
50       return str << "File " << _filename
51         << " not found on media: " << _url << endl;
52     }
53
54     std::ostream & MediaWriteException::dumpOn( std::ostream & str) const
55     {
56       return str << "Cannot write file " << _filename << endl;
57     }
58
59     std::ostream & MediaNotAttachedException::dumpOn( std::ostream & str) const
60     {
61       return str << "Media not attached: " << _url << endl;
62     }
63
64     std::ostream & MediaBadAttachPointException::dumpOn( std::ostream & str) const
65     {
66       return str << "Bad media attach point: " << _url << endl;
67     }
68
69     std::ostream & MediaCurlInitException::dumpOn( std::ostream & str) const
70     {
71       return str << "Curl init failed for: " << _url << endl;
72     }
73
74     std::ostream & MediaSystemException::dumpOn( std::ostream & str) const
75     {
76       return str << "System exception: " << _message
77         << " on media: " << _url << endl;
78     }
79
80     std::ostream & MediaNotAFileException::dumpOn( std::ostream & str) const
81     {
82       return str << "Path " << _path
83         << " on media: " << _url
84         << " is not a file." << endl;
85     }
86
87     std::ostream & MediaNotADirException::dumpOn( std::ostream & str) const
88     {
89       return str << "Path " << _path
90         << " on media: " << _url
91         << " is not a directory." << endl;
92     }
93
94     std::ostream & MediaBadUrlException::dumpOn( std::ostream & str) const
95     {
96       return str << "Malformed URL: " << _url << endl;
97     }
98
99     std::ostream & MediaBadUrlEmptyHostException::dumpOn( std::ostream & str) const
100     {
101       return str << "Empty host name in URL: " << _url << endl;
102     }
103
104     std::ostream & MediaBadUrlEmptyFilesystemException::dumpOn( std::ostream & str) const
105     {
106       return str << "Empty filesystem in URL: " << _url << endl;
107     }
108
109     std::ostream & MediaBadUrlEmptyDestinationException::dumpOn( std::ostream & str) const
110     {
111       return str << "Empty destination in URL: " << _url << endl;
112     }
113
114     std::ostream & MediaUnsupportedUrlSchemeException::dumpOn( std::ostream & str) const
115     {
116       return str << "Unsupported URL scheme in URL: " << _url << endl;
117     }
118
119     std::ostream & MediaNotSupportedException::dumpOn( std::ostream & str) const
120     {
121       return str << "Operation not supported by media: " << _url << endl;
122     }
123
124     std::ostream & MediaCurlException::dumpOn( std::ostream & str) const
125     {
126       return str << "Curl error for: " << _url
127         << ": Error code: " << _err
128         << " Error message: " << _msg << endl;
129     }
130
131     std::ostream & MediaCurlSetOptException::dumpOn( std::ostream & str) const
132     {
133       return str << "Error occurred while setting CURL options for " << _url
134         << ": " << _msg << endl;
135     }
136
137     std::ostream & MediaNotDesiredException::dumpOn( std::ostream & str ) const
138     {
139       return str << "Media source " << _url << " does not contain the desired media" << endl;
140     }
141
142     std::ostream & MediaIsSharedException::dumpOn( std::ostream & str ) const
143     {
144       return str << "Media " << _name << " is in use by another instance" << endl;
145     }
146
147   /////////////////////////////////////////////////////////////////
148   } // namespace media
149 } // namespace zypp
150 ///////////////////////////////////////////////////////////////////