chiark / gitweb /
build: log vcs tools version on every build attempt
[fdroidserver.git] / fdroidserver / exception.py
1 class FDroidException(Exception):
2
3     def __init__(self, value=None, detail=None):
4         self.value = value
5         self.detail = detail
6
7     def shortened_detail(self):
8         if len(self.detail) < 16000:
9             return self.detail
10         return '[...]\n' + self.detail[-16000:]
11
12     def get_wikitext(self):
13         ret = repr(self.value) + "\n"
14         if self.detail:
15             ret += "=detail=\n"
16             ret += "<pre>\n" + self.shortened_detail() + "</pre>\n"
17         return ret
18
19     def __str__(self):
20         if self.value is None:
21             ret = __name__
22         else:
23             ret = str(self.value)
24         if self.detail:
25             ret += "\n==== detail begin ====\n%s\n==== detail end ====" % ''.join(self.detail).strip()
26         return ret
27
28
29 class MetaDataException(Exception):
30
31     def __init__(self, value):
32         self.value = value
33
34     def __str__(self):
35         return self.value
36
37
38 class VCSException(FDroidException):
39     pass
40
41
42 class BuildException(FDroidException):
43     pass
44
45
46 class VerificationException(FDroidException):
47     pass