Browse Source

Add an attribute that turns request handler stack traces off

jonathanvdc 8 years ago
parent
commit
960614f697
1 changed files with 5 additions and 1 deletions
  1. 5 1
      kernel/modelverse_kernel/request_handler.py

+ 5 - 1
kernel/modelverse_kernel/request_handler.py

@@ -66,6 +66,7 @@ class RequestHandler(object):
         # (generator_stack index, [(exception type, handler function)])
         # tuples.
         self.exception_handlers = []
+        self.produce_stack_trace = True
         self.handlers = {
             'CALL' : self.execute_call,
             'CALL_ARGS' : self.execute_call_args,
@@ -129,7 +130,10 @@ class RequestHandler(object):
                 # Maybe get an exception handler to do this.
                 stack_trace = self.handle_exception(ex)
                 if stack_trace is not None:
-                    raise UnhandledRequestHandlerException(ex, stack_trace)
+                    if self.produce_stack_trace:
+                        raise UnhandledRequestHandlerException(ex, stack_trace)
+                    else:
+                        raise
 
     def set_finished_requests_flag(self):
         """Sets the finished_requests flag in the top-of-stack tuple."""