Skip to content

Commit

Permalink
handle non-ServerApp global instance
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Mar 14, 2022
1 parent f955878 commit acf2fc6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions jupyter_server/extension/application.py
Expand Up @@ -213,11 +213,15 @@ def _default_url(self):
def _default_serverapp(self):
# load the current global instance, if any
if ServerApp.initialized():
return ServerApp.instance()
else:
# serverapp accessed before it was defined,
# declare an empty one
return ServerApp()
try:
return ServerApp.instance()
except Exception:
# error retrieving instance, e.g. MultipleInstanceError
pass

# serverapp accessed before it was defined,
# declare an empty one
return ServerApp()

_log_formatter_cls = LogFormatter

Expand Down

0 comments on commit acf2fc6

Please sign in to comment.