From e29da6b0231989fee32d57571857e4fb0e04fcaf Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Tue, 20 May 2014 22:14:19 +0100 Subject: [PATCH] Restore friendly error messages Use --verbose if you really want a full traceback with your 'you made a typo in an package ID' messages. It would be better to do this based on exception types (i.e. our own exceptions - MetadataException, BuildException, VCSException) would not print a traceback, but unexpected exceptions would. But the types are not available at the 'fdroid' level currently. --- fdroid | 9 ++++++++- fdroidserver/common.py | 4 ++-- fdroidserver/metadata.py | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/fdroid b/fdroid index b6e37dc7..a2035fa2 100755 --- a/fdroid +++ b/fdroid @@ -83,7 +83,14 @@ def main(): del sys.argv[1] mod = __import__('fdroidserver.' + command, None, None, [command]) - mod.main() + try: + mod.main() + except Exception, e: + if verbose: + raise + else: + print str(e) + sys.exit(1) sys.exit(0) if __name__ == "__main__": diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 93ec3531..c278beed 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -907,7 +907,7 @@ class BuildException(Exception): return ret def __str__(self): - ret = repr(self.value) + ret = self.value if self.detail: ret += "\n==== detail begin ====\n%s\n==== detail end ====" % self.detail.strip() return ret @@ -918,7 +918,7 @@ class VCSException(Exception): self.value = value def __str__(self): - return repr(self.value) + return self.value # Get the specified source library. diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index cbb4a86d..5b075385 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -23,13 +23,14 @@ import glob import cgi import logging +srclibs = [] class MetaDataException(Exception): def __init__(self, value): self.value = value def __str__(self): - return repr(self.value) + return self.value app_defaults = { 'Name': None, -- 2.30.2