Skip to content

Commit e9134ce

Browse files
committed
fix!: Make unauth call error message as PermissionError
1 parent 6d95619 commit e9134ce

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/toolbox-core/src/toolbox_core/tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ async def __call__(self, *args: Any, **kwargs: Any) -> str:
239239
for s in self.__required_authn_params.values():
240240
req_auth_services.update(s)
241241
req_auth_services.update(self.__required_authz_tokens)
242-
raise ValueError(
242+
raise PermissionError(
243243
f"One or more of the following authn services are required to invoke this tool"
244244
f": {','.join(req_auth_services)}"
245245
)

packages/toolbox-core/tests/test_e2e.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ async def test_run_tool_no_auth(self, toolbox: ToolboxClient):
147147
"""Tests running a tool requiring auth without providing auth."""
148148
tool = await toolbox.load_tool("get-row-by-id-auth")
149149
with pytest.raises(
150-
Exception,
150+
PermissionError,
151151
match="One or more of the following authn services are required to invoke this tool: my-test-auth",
152152
):
153153
await tool(id="2")
@@ -188,7 +188,7 @@ async def test_run_tool_param_auth_no_auth(self, toolbox: ToolboxClient):
188188
"""Tests running a tool with a param requiring auth, without auth."""
189189
tool = await toolbox.load_tool("get-row-by-email-auth")
190190
with pytest.raises(
191-
ValueError,
191+
PermissionError,
192192
match="One or more of the following authn services are required to invoke this tool: my-test-auth",
193193
):
194194
await tool()

0 commit comments

Comments
 (0)