Commits

Olemis Lang committed 5ef5855

BH RPC : Report: Fail gracefully if report is missing

  • Participants
  • Parent commits cc20cff

Comments (0)

Files changed (1)

trunk/tracrpc/report.py

                       consists of a `TracQuery` containing syntax errors.
         @throws       `Exception` in case of detecting any other error.
         """
-        sql = self.get(req, id)['query']
+        report = self.get(req, id)
+        if report is None:
+            raise ValueError(_('Report failed: %(error)s', error='Missing report'))
+        sql = report['query']
         query = ''.join([line.strip() for line in sql.splitlines()])
         if query and (query[0] == '?' or query.startswith('query:?')):
           raise NotImplementedError('Saved custom queries specified ' \