Skip to content

Commit

Permalink
Refactor notebook creation API endpoint and model to handle error res…
Browse files Browse the repository at this point in the history
…ponse from Jupyter Server
  • Loading branch information
xuwenyihust committed Jul 2, 2024
1 parent e60e6d7 commit 8bdcbad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/app/services/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def get_notebook_by_path(notebook_path: str = None):
try:
path = f"{jupyter_api_path}/{notebook_path}"
response = requests.get(path)
logger.info(f"Response: {response.content}")
if response.status_code != 200:
return jsonify({'message': 'Error getting notebook from Jupyter Server'}), 404
except Exception as e:
return jsonify({'message': 'Error getting notebook from Jupyter Server: ' + str(e)}), 404

Expand All @@ -42,7 +45,6 @@ def get_notebook_by_path(notebook_path: str = None):
except Exception as e:
return jsonify({'message': 'Error getting notebook from DB: ' + str(e)}), 404

logger.info(f"Response: {response.json()}")
return response.json()

@staticmethod
Expand Down

0 comments on commit 8bdcbad

Please sign in to comment.