Browse Source

Merge pull request #59 from algoo/feature/58__include_traceback_in_general_exception_catcher

inkhey 6 years ago
parent
commit
a2ce52f727
No account linked to committer's email
2 changed files with 8 additions and 2 deletions
  1. 4 1
      hapic/context.py
  2. 4 1
      hapic/ext/pyramid/context.py

+ 4 - 1
hapic/context.py View File

@@ -202,7 +202,10 @@ class BaseContext(ContextInterface):
202 202
                     # TODO BS 2018-05-04: How to be attentive to hierarchy ?
203 203
                     if isinstance(exc, handled_exception.exception_class):
204 204
                         error_builder = self.get_default_error_builder()
205
-                        error_body = error_builder.build_from_exception(exc)
205
+                        error_body = error_builder.build_from_exception(
206
+                            exc,
207
+                            include_traceback=self.is_debug(),
208
+                        )
206 209
                         return self.get_response(
207 210
                             json.dumps(error_body),
208 211
                             handled_exception.http_code,

+ 4 - 1
hapic/ext/pyramid/context.py View File

@@ -194,7 +194,10 @@ class PyramidContext(BaseContext):
194 194
             def view_func(exc, request):
195 195
                 # TODO BS 2018-05-04: How to be attentive to hierarchy ?
196 196
                 error_builder = self.get_default_error_builder()
197
-                error_body = error_builder.build_from_exception(exc)
197
+                error_body = error_builder.build_from_exception(
198
+                    exc,
199
+                    include_traceback=self.is_debug(),
200
+                )
198 201
                 return self.get_response(
199 202
                     json.dumps(error_body),
200 203
                     http_code