Skip to content

Commit acf2fc6

Browse files
committed
handle non-ServerApp global instance
1 parent f955878 commit acf2fc6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

jupyter_server/extension/application.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,15 @@ def _default_url(self):
213213
def _default_serverapp(self):
214214
# load the current global instance, if any
215215
if ServerApp.initialized():
216-
return ServerApp.instance()
217-
else:
218-
# serverapp accessed before it was defined,
219-
# declare an empty one
220-
return ServerApp()
216+
try:
217+
return ServerApp.instance()
218+
except Exception:
219+
# error retrieving instance, e.g. MultipleInstanceError
220+
pass
221+
222+
# serverapp accessed before it was defined,
223+
# declare an empty one
224+
return ServerApp()
221225

222226
_log_formatter_cls = LogFormatter
223227

0 commit comments

Comments
 (0)