summaryrefslogtreecommitdiff
path: root/tools/scan-view/Reporter.py
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-09-20 01:43:16 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-09-20 01:43:16 +0000
commit5472249ee4281673c63db466c8670f269803469a (patch)
treedf539add6ab80a227307612054f71da9be325dd8 /tools/scan-view/Reporter.py
parente33d3682b6f4ba798b9d8d6f395ac8003827c03b (diff)
downloadclang-5472249ee4281673c63db466c8670f269803469a.tar.gz
clang-5472249ee4281673c63db466c8670f269803469a.tar.bz2
clang-5472249ee4281673c63db466c8670f269803469a.tar.xz
Make scan-view more robust / friendly when bug reporting fails.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56382 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/scan-view/Reporter.py')
-rw-r--r--tools/scan-view/Reporter.py34
1 files changed, 26 insertions, 8 deletions
diff --git a/tools/scan-view/Reporter.py b/tools/scan-view/Reporter.py
index a28d0945ac..5bfe446906 100644
--- a/tools/scan-view/Reporter.py
+++ b/tools/scan-view/Reporter.py
@@ -2,7 +2,14 @@
import subprocess, sys, os
-__all__ = ['BugReport', 'getReporters']
+__all__ = ['ReportFailure', 'BugReport', 'getReporters']
+
+#
+
+class ReportFailure(Exception):
+ """Generic exception for failures in bug reporting."""
+ def __init__(self, value):
+ self.value = value
# Collect information about a bug.
@@ -135,18 +142,29 @@ class RadarReporter:
p = subprocess.Popen(args,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except:
- print >>sys.stderr, '%s: SERVER: radar failed'%(sys.argv[0],)
- sys.print_exc()
- raise
+ raise ReportFailure("Unable to file radar (AppleScript failure).")
data, err = p.communicate()
-# print >>sys.stderr, '%s: SERVER: radar report: "%s" "%s"'%(sys.argv[0],data, err)
res = p.wait()
-# print >>sys.stderr, '%s: SERVER: radar report res: %d'%(sys.argv[0],res,)
if res:
- raise RuntimeError,'Radar submission failed.'
+ raise ReportFailure("Unable to file radar (AppleScript failure).")
+
+ try:
+ values = eval(data)
+ except:
+ raise ReportFailure("Unable to process radar results.")
- return data.replace('\n','\n<br>')
+ # We expect (int: bugID, str: message)
+ if len(values) != 2 or not isinstance(values[0], int):
+ raise ReportFailure("Unable to process radar results.")
+
+ bugID,message = values
+ bugID = int(bugID)
+
+ if not bugID:
+ raise ReportFailure(message)
+
+ return "Filed: <a href=\"rdar://%d/\">%d</a>"%(bugID,bugID)
###