1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-11 07:10:12 +02:00
fdroidserver/fdroidserver/exception.py
Marcus Hoffmann db0a97e8e7 checkupdates: don't fail when we can't init submodules
Later revisions might have removed the submodules so we want to keep
going when there are no submodules present.
We still abort when there is an error initializing submodules.

Fixes fdroid/fdroidserver#231
2017-12-04 16:30:37 +01:00

52 lines
1.1 KiB
Python

class FDroidException(Exception):
def __init__(self, value=None, detail=None):
self.value = value
self.detail = detail
def shortened_detail(self):
if len(self.detail) < 16000:
return self.detail
return '[...]\n' + self.detail[-16000:]
def get_wikitext(self):
ret = repr(self.value) + "\n"
if self.detail:
ret += "=detail=\n"
ret += "<pre>\n" + self.shortened_detail() + "</pre>\n"
return ret
def __str__(self):
if self.value is None:
ret = __name__
else:
ret = str(self.value)
if self.detail:
ret += "\n==== detail begin ====\n%s\n==== detail end ====" % ''.join(self.detail).strip()
return ret
class MetaDataException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return self.value
class VCSException(FDroidException):
pass
class NoSubmodulesException(VCSException):
pass
class BuildException(FDroidException):
pass
class VerificationException(FDroidException):
pass