unify the license header of all files
[tools/mic.git] / mic / utils / errors.py
1 #!/usr/bin/python -tt
2 #
3 # Copyright (c) 2007 Red Hat, Inc.
4 # Copyright (c) 2011 Intel, Inc.
5 #
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by the Free
8 # Software Foundation; version 2 of the License
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 # for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc., 59
17 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 class CreatorError(Exception):
20     """An exception base class for all imgcreate errors."""
21     keyword = '<creator>'
22
23     def __init__(self, msg):
24         self.msg = msg
25
26     def __str__(self):
27         return self.keyword + str(self.msg)
28
29 class Usage(CreatorError):
30     keyword = '<usage>'
31
32     def __str__(self):
33         return self.keyword + str(self.msg) + ', please use "--help" for more info'
34
35 class ConfigError(CreatorError):
36     keyword = '<config>'
37
38 class KsError(CreatorError):
39     keyword = '<kickstart>'
40
41 class MountError(CreatorError):
42     keyword = '<mount>'
43
44 class SnapshotError(CreatorError):
45     keyword = '<snapshot>'
46
47 class SquashfsError(CreatorError):
48     keyword = '<squashfs>'