Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/claude_agent_sdk/_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class CLINotFoundError(CLIConnectionError):
def __init__(
self, message: str = "Claude Code not found", cli_path: str | None = None
):
self.cli_path = cli_path
if cli_path:
message = f"{message}: {cli_path}"
super().__init__(message)
Expand Down
8 changes: 8 additions & 0 deletions tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ def test_cli_not_found_error(self):
error = CLINotFoundError("Claude Code not found")
assert isinstance(error, ClaudeSDKError)
assert "Claude Code not found" in str(error)
assert error.cli_path is None

def test_cli_not_found_error_with_path(self):
"""Test CLINotFoundError stores cli_path and includes it in the message."""
error = CLINotFoundError("Claude Code not found", cli_path="/usr/bin/claude")
assert error.cli_path == "/usr/bin/claude"
assert "Claude Code not found" in str(error)
assert "/usr/bin/claude" in str(error)

def test_connection_error(self):
"""Test CLIConnectionError."""
Expand Down