Skip to content

Commit

Permalink
Identify httpx ReadTimeout errors from execution
Browse files Browse the repository at this point in the history
Specifically identify when the JupyterLab /execution request fails
because of a timeout.
  • Loading branch information
jonathansick committed Mar 22, 2024
1 parent 0ffe9c3 commit 8ccb198
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/noteburst/jupyterclient/jupyterlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,13 +732,22 @@ async def execute_notebook(
content=json.dumps(notebook).encode("utf-8"),
headers=headers,
)
except httpx.ReadTimeout as e:
raise JupyterError(
url=exec_url,
username=self.user.username,
status=r.status_code,
reason="/execution endpoint timeout",
method="POST",
body=str(e),
) from e
except httpx.HTTPError as e:
# This often occurs from timeouts, so we want to convert the
# generic HTTPError to a JupyterError.
raise JupyterError(
url=exec_url,
username=self.user.username,
status=500,
status=r.status_code,
reason="Internal Server Error",
method="POST",
body=str(e),
Expand Down

0 comments on commit 8ccb198

Please sign in to comment.