chiark / gitweb /
Restore friendly error messages
authorCiaran Gultnieks <ciaran@ciarang.com>
Tue, 20 May 2014 21:14:19 +0000 (22:14 +0100)
committerCiaran Gultnieks <ciaran@ciarang.com>
Tue, 20 May 2014 21:14:19 +0000 (22:14 +0100)
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
fdroidserver/common.py
fdroidserver/metadata.py

diff --git a/fdroid b/fdroid
index b6e37dc7265d652374e8da91c3a31c32fd88e4c1..a2035fa2318d99f1ab5c468eec124b5f688482d3 100755 (executable)
--- 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__":
index 93ec35318686112577e1ce666568894c6f6c6462..c278beed203f4cb02dc78156ff67d01e8148caf8 100644 (file)
@@ -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.
index cbb4a86dc6445cd7091876077545f18613d25a2c..5b0753859c1bcb7714c9af23e4ee16af55ccb17b 100644 (file)
@@ -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,