Skip to content

Commit 3f017e9

Browse files
krisctlprabhakk-mw
authored andcommitted
Improved error message handling and updates minimum version dependency of matlab-proxy to v0.25.0
1 parent 3b38cc1 commit 3f017e9

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ dependencies = [
4343
"ipykernel>=6.0.3",
4444
"jupyter-client",
4545
"jupyter-server-proxy>=4.1.0",
46-
"matlab-proxy>=0.23.3",
46+
"matlab-proxy>=0.25.0",
4747
"psutil",
4848
"requests",
4949
]

src/jupyter_matlab_kernel/mpm_kernel.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 The MathWorks, Inc.
1+
# Copyright 2024-2025 The MathWorks, Inc.
22

33
"""This module contains derived class implementation of MATLABKernel that uses
44
MATLAB Proxy Manager to manage interactions with matlab-proxy & MATLAB.
@@ -93,7 +93,7 @@ async def do_shutdown(self, restart):
9393
async def perform_startup_checks(self):
9494
"""Overriding base function to provide a different iframe source"""
9595
await super().perform_startup_checks(
96-
self.jupyter_base_url, f'{self.matlab_proxy_base_url.lstrip("/")}/'
96+
self.jupyter_base_url, f"{self.matlab_proxy_base_url.lstrip('/')}/"
9797
)
9898

9999
# Helper functions
@@ -139,19 +139,23 @@ async def _initialize_matlab_proxy_with_mpm(self, _logger: Logger):
139139
parent_id=self.parent_pid,
140140
is_shared_matlab=True,
141141
)
142+
err = response.get("errors")
143+
if err:
144+
raise MATLABConnectionError(err)
142145
return (
143146
response.get("absolute_url"),
144147
response.get("mwi_base_url"),
145148
response.get("headers"),
146149
response.get("mpm_auth_token"),
147150
)
148151
except Exception as e:
149-
_logger.error(
150-
f"MATLAB Kernel could not start matlab-proxy using proxy manager with error: {e}"
151-
)
152+
_logger.error(f"MATLAB Kernel could not start matlab-proxy, Reason: {e}")
152153
raise MATLABConnectionError(
153-
"""
154-
Error: MATLAB Kernel could not start the MATLAB proxy process via proxy manager.
154+
f"""
155+
Error: MATLAB Kernel could not start the MATLAB proxy process.
156+
Reason: {e}
157+
Resolution: Run the troubleshooting script described in the file `troubleshooting.md`.
158+
If the issue persists, create an issue on Github: https://github.com/mathworks/jupyter-matlab-proxy/issues.
155159
"""
156160
) from e
157161

tests/unit/jupyter_matlab_kernel/test_mpm_kernel.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 The MathWorks, Inc.
1+
# Copyright 2024-2025 The MathWorks, Inc.
22

33
import uuid
44

@@ -59,10 +59,7 @@ async def test_initialize_matlab_proxy_with_mpm_exception(mocker, mpm_kernel_ins
5959
await mpm_kernel_instance._initialize_matlab_proxy_with_mpm(
6060
mpm_kernel_instance.log
6161
)
62-
assert (
63-
"Error: MATLAB Kernel could not start the MATLAB proxy process via proxy manager."
64-
in str(exc_info.value)
65-
)
62+
assert "Simulated failure" in str(exc_info.value)
6663

6764

6865
async def test_initialize_mwi_comm_helper(mocker, mpm_kernel_instance):

0 commit comments

Comments
 (0)