2 # Copyright (c) 2011~2013 Intel, Inc.
4 # This program is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by the Free
6 # Software Foundation; version 2 of the License
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc., 59
15 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 """ Collection of all error class """
19 class CreatorError(Exception):
20 """ Based class for all mic creator errors """
23 def __init__(self, msg):
24 Exception.__init__(self)
28 if isinstance(self.msg, unicode):
29 self.msg = self.msg.encode('utf-8', 'ignore')
31 self.msg = str(self.msg)
35 if not hasattr(self, 'keyword') or not self.keyword:
36 self.keyword = self.__class__.__name__
37 return "<%s> %s" % (self.keyword, str(self))
39 class Usage(CreatorError):
40 """ Error class for Usage """
43 class Abort(CreatorError):
44 """ Error class for Abort """
47 class ConfigError(CreatorError):
48 """ Error class for Config file """
51 class KsError(CreatorError):
52 """ Error class for Kickstart module """
55 class RepoError(CreatorError):
56 """ Error class for Repository related """
57 keyword = 'Repository'
59 class RpmError(CreatorError):
60 """ Error class for RPM related """
63 class MountError(CreatorError):
64 """ Error class for Mount related """
67 class SnapshotError(CreatorError):
68 """ Error class for Snapshot related """
71 class SquashfsError(CreatorError):
72 """ Error class for Squashfs related """
75 class VdfsError(CreatorError):
76 """ Error class for Vdfs related """
79 class BootstrapError(CreatorError):
80 """ Error class for Bootstrap related """