1
|
|
|
from clyent.errors import ClyentError |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
class BinstarError(ClyentError): |
5
|
|
|
def __init__(self, *args, **kwargs): |
6
|
|
|
Exception.__init__(self, *args, **kwargs) |
7
|
|
|
|
8
|
|
|
if not hasattr(self, 'message'): |
9
|
|
|
self.message = args[0] if args else None |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class Unauthorized(BinstarError): |
13
|
|
|
pass |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
class Conflict(BinstarError): |
17
|
|
|
pass |
18
|
|
|
|
19
|
|
|
|
20
|
|
|
class NotFound(BinstarError, IndexError): |
21
|
|
|
def __init__(self, *args, **kwargs): |
22
|
|
|
BinstarError.__init__(self, *args, **kwargs) |
23
|
|
|
IndexError.__init__(self, *args, **kwargs) |
24
|
|
|
self.message = args[0] |
25
|
|
|
self.msg = args[0] |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
class UserError(BinstarError): |
29
|
|
|
pass |
30
|
|
|
|
31
|
|
|
|
32
|
|
|
class ServerError(BinstarError): |
33
|
|
|
pass |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
class ShowHelp(BinstarError): |
37
|
|
|
pass |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
class NoMetadataError(BinstarError): |
41
|
|
|
pass |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
class DestionationPathExists(BinstarError): |
45
|
|
|
def __init__(self, location): |
46
|
|
|
self.msg = "destination path '{}' already exists.".format(location) |
47
|
|
|
self.location = location |
48
|
|
|
super(BinstarError, self).__init__(self.msg) |
49
|
|
|
|
50
|
|
|
|
51
|
|
|
class PillowNotInstalled(BinstarError): |
52
|
|
|
def __init__(self): |
53
|
|
|
self.msg = ("pillow is not installed. Install it with:\n" |
54
|
|
|
" conda install pillow") |
55
|
|
|
super(BinstarError, self).__init__(self.msg) |
56
|
|
|
|