Skip to content

fix(python): raise SandboxError instead of FileNotFoundError or KeyError#1547

Open
mesutoezdil wants to merge 2 commits into
NVIDIA:mainfrom
mesutoezdil:fix/sandbox-py-error-handling
Open

fix(python): raise SandboxError instead of FileNotFoundError or KeyError#1547
mesutoezdil wants to merge 2 commits into
NVIDIA:mainfrom
mesutoezdil:fix/sandbox-py-error-handling

Conversation

@mesutoezdil
Copy link
Copy Markdown
Contributor

@mesutoezdil mesutoezdil commented May 23, 2026

_resolve_active_cluster: wraps read_text() in a try/except FileNotFoundError so a missing active gateway file raises SandboxError with a clear message instead of a raw Python exception

from_active_cluster: same fix for metadata.json not found, plus an explicit check for the missing gateway_endpoint key

All other error paths in the file already raise SandboxError.

These 2 were inconsistent.

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 23, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

johntmyers
johntmyers previously approved these changes May 23, 2026
@johntmyers
Copy link
Copy Markdown
Collaborator

/ok to test 68a2b53

@johntmyers
Copy link
Copy Markdown
Collaborator

@mesutoezdil please address the failing checks. you should be able to run these checks on your local branches before opening PRs.

Add `from None` to both `raise SandboxError(...)` calls inside `except
FileNotFoundError` blocks to satisfy ruff B904.
@mesutoezdil
Copy link
Copy Markdown
Contributor Author

@mesutoezdil please address the failing checks. you should be able to run these checks on your local branches before opening PRs.

Screenshot 2026-05-23 at 19 29 09

Sorry for missing that. Ran mise run python:lint locally and caught the two B904 violations.
Fixed and pushed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants