Skip to content

Commit 9411369

Browse files
committed
docs: Improve error handling for toolbox-core client
1 parent 813d60e commit 9411369

File tree

1 file changed

+5
-1
lines changed
  • packages/toolbox-core/src/toolbox_core

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515

16-
from asyncio import get_running_loop
1716
from types import MappingProxyType
1817
from typing import Any, Awaitable, Callable, Mapping, Optional, Union
1918

@@ -272,6 +271,11 @@ async def load_toolset(
272271
# Request the definition of the toolset from the server
273272
url = f"{self.__base_url}/api/toolset/{name or ''}"
274273
async with self.__session.get(url, headers=resolved_headers) as response:
274+
if response.status != 200:
275+
error_text = await response.text()
276+
raise RuntimeError(
277+
f"API request failed with status {response.status} ({response.reason}). Server response: {error_text}"
278+
)
275279
json = await response.json()
276280
manifest: ManifestSchema = ManifestSchema(**json)
277281

0 commit comments

Comments
 (0)