summaryrefslogtreecommitdiff
path: root/patchtracker
diff options
context:
space:
mode:
authorsean finey <seanius@debian.org>2009-02-12 23:08:19 +0100
committersean finey <seanius@debian.org>2009-02-12 23:08:19 +0100
commit965a7af0fe6ce951bbf867b39379a23a6684e957 (patch)
tree99161591ed25b3658a2bb22c912c2021fd9d6ec6 /patchtracker
parenta6d05c5f6f1de8a9e0e43264624038c0f3f24cfb (diff)
downloadpatch-tracker-965a7af0fe6ce951bbf867b39379a23a6684e957.tar.gz
fail more gracefully if a diff.gz is missing
this should never happen in production as the database contains only a cache of what's on disk, but during testing on a system with the database and no archive, or in unexpected circumstances, it might be helpful to give a more informative error page.
Diffstat (limited to 'patchtracker')
-rw-r--r--patchtracker/DiffGzHandler.py5
-rwxr-xr-xpatchtracker/ReqHandler.py7
2 files changed, 9 insertions, 3 deletions
diff --git a/patchtracker/DiffGzHandler.py b/patchtracker/DiffGzHandler.py
index 1f1c1de..96d862b 100644
--- a/patchtracker/DiffGzHandler.py
+++ b/patchtracker/DiffGzHandler.py
@@ -3,6 +3,9 @@ import sys
import os
from Patch import Patch, PatchSeries
+class DiffGzException(Exception):
+ pass
+
class DiffGzHandler:
diff = None
def __init__(self,fname):
@@ -21,7 +24,7 @@ class DiffGzHandler:
p = Patch(o)
err = e.read()
if len(err):
- raise Exception("filterdiff gave errors:",err)
+ raise DiffGzException("filterdiff gave errors: "+err)
return p
def debiandir(self):
diff --git a/patchtracker/ReqHandler.py b/patchtracker/ReqHandler.py
index a41114f..a87fd68 100755
--- a/patchtracker/ReqHandler.py
+++ b/patchtracker/ReqHandler.py
@@ -6,7 +6,7 @@ import sys
import patchtracker.Conf as Conf
from patchtracker.Templates import ErrorTemplate, PatchTemplate, PackageVersTemplate, LetterTocTemplate, FrontPageTemplate, SearchResultsTemplate
-from patchtracker.DiffGzHandler import DiffGzHandler
+from patchtracker.DiffGzHandler import DiffGzHandler, DiffGzException
import patchtracker.DB as DB
from patchtracker.DB import PatchTrackerDB
import pygments
@@ -182,4 +182,7 @@ class CmdHandler:
self.status = self.cmd.status
def output(self):
- return self.cmd.output()
+ try:
+ return self.cmd.output()
+ except DiffGzException, e:
+ return ErrorCmd(str(e), "500 Oh Noez!!1!").output()