##// END OF EJS Templates
Handle NoSuchKernel errors more gracefully
Jessica B. Hamrick -
Show More
@@ -10,6 +10,7 b' from tornado import web'
10 10 from ...base.handlers import IPythonHandler, json_errors
11 11 from IPython.utils.jsonutil import date_default
12 12 from IPython.html.utils import url_path_join, url_escape
13 from IPython.kernel.kernelspec import NoSuchKernel
13 14
14 15
15 16 class SessionRootHandler(IPythonHandler):
@@ -52,7 +53,11 b' class SessionRootHandler(IPythonHandler):'
52 53 if sm.session_exists(name=name, path=path):
53 54 model = sm.get_session(name=name, path=path)
54 55 else:
55 model = sm.create_session(name=name, path=path, kernel_name=kernel_name)
56 try:
57 model = sm.create_session(name=name, path=path, kernel_name=kernel_name)
58 except NoSuchKernel:
59 raise web.HTTPError(400, "No such kernel: %s" % kernel_name)
60
56 61 location = url_path_join(self.base_url, 'api', 'sessions', model['id'])
57 62 self.set_header('Location', url_escape(location))
58 63 self.set_status(201)
General Comments 0
You need to be logged in to leave comments. Login now