##// END OF EJS Templates
allow exceptions in handlers without crashing
MinRK -
Show More
@@ -185,7 +185,10 b' class Kernel(Configurable):'
185 if handler is None:
185 if handler is None:
186 self.log.error("UNKNOWN CONTROL MESSAGE TYPE: %r", msg_type)
186 self.log.error("UNKNOWN CONTROL MESSAGE TYPE: %r", msg_type)
187 else:
187 else:
188 handler(self.control_stream, idents, msg)
188 try:
189 handler(self.control_stream, idents, msg)
190 except Exception:
191 self.log.error("Exception in control handler:", exc_info=True)
189
192
190 def dispatch_shell(self, stream, msg):
193 def dispatch_shell(self, stream, msg):
191 """dispatch shell requests"""
194 """dispatch shell requests"""
@@ -227,6 +230,8 b' class Kernel(Configurable):'
227 sig = signal(SIGINT, default_int_handler)
230 sig = signal(SIGINT, default_int_handler)
228 try:
231 try:
229 handler(stream, idents, msg)
232 handler(stream, idents, msg)
233 except Exception:
234 self.log.error("Exception in message handler:", exc_info=True)
230 finally:
235 finally:
231 signal(SIGINT, sig)
236 signal(SIGINT, sig)
232
237
@@ -363,9 +368,9 b' class Kernel(Configurable):'
363 # or not. If it did, we proceed to evaluate user_variables/expressions
368 # or not. If it did, we proceed to evaluate user_variables/expressions
364 if reply_content['status'] == 'ok':
369 if reply_content['status'] == 'ok':
365 reply_content[u'user_variables'] = \
370 reply_content[u'user_variables'] = \
366 shell.user_variables(content[u'user_variables'])
371 shell.user_variables(content.get(u'user_variables', []))
367 reply_content[u'user_expressions'] = \
372 reply_content[u'user_expressions'] = \
368 shell.user_expressions(content[u'user_expressions'])
373 shell.user_expressions(content.get(u'user_expressions', {}))
369 else:
374 else:
370 # If there was an error, don't even try to compute variables or
375 # If there was an error, don't even try to compute variables or
371 # expressions
376 # expressions
General Comments 0
You need to be logged in to leave comments. Login now