Edgewall Software

Changes between Initial Version and Version 1 of Ticket #12385, comment 9


Ignore:
Timestamp:
Mar 18, 2016, 9:54:16 AM (8 years ago)
Author:
Jun Omae

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12385, comment 9

    initial v1  
    99{{{#!diff
    1010diff --git a/trac/web/main.py b/trac/web/main.py
    11 index d30956db8..e65d9d71b 100644
     11index d30956db8..3be58af91 100644
    1212--- a/trac/web/main.py
    1313+++ b/trac/web/main.py
     
    2020 from genshi.builder import tag
    2121 from genshi.output import DocType
    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
    3544}}}