22 | | @@ -275,6 +276,12 @@ class RequestDispatcher(Component): |
23 | | self._post_process_request(req) |
24 | | except RequestDone: |
25 | | raise |
26 | | + except NotImplementedError as e: |
27 | | + tb = traceback.extract_tb(sys.exc_info()[2])[-1] |
28 | | + self.log.warning('%s caught from %s:%d in %s: %s', |
29 | | + e.__class__.__name__, tb[0], tb[1], tb[2], |
30 | | + to_unicode(e) or '(no message)') |
31 | | + raise HTTPInternalError(TracNotImplementedError(e)) |
32 | | except Exception as e: |
33 | | # post-process the request in case of errors |
34 | | err = sys.exc_info() |
| 22 | @@ -288,12 +289,17 @@ class RequestDispatcher(Component): |
| 23 | exception_to_unicode(e2, traceback=True)) |
| 24 | if isinstance(e, PermissionError): |
| 25 | raise HTTPForbidden(e) |
| 26 | - elif isinstance(e, ResourceNotFound): |
| 27 | + if isinstance(e, ResourceNotFound): |
| 28 | raise HTTPNotFound(e) |
| 29 | - elif isinstance(e, TracError): |
| 30 | + if isinstance(e, NotImplementedError): |
| 31 | + tb = traceback.extract_tb(err[2])[-1] |
| 32 | + self.log.warning('%s caught from %s:%d in %s: %s', |
| 33 | + e.__class__.__name__, tb[0], tb[1], tb[2], |
| 34 | + to_unicode(e) or '(no message)') |
| 35 | + raise HTTPInternalError(TracNotImplementedError(e)) |
| 36 | + if isinstance(e, TracError): |
| 37 | raise HTTPInternalError(e) |
| 38 | - else: |
| 39 | - raise err[0], err[1], err[2] |
| 40 | + raise err[0], err[1], err[2] |
| 41 | |
| 42 | # ITemplateProvider methods |
| 43 | |