mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
- Remove all unconditional pytest.skip() calls - Fix file content tests to handle both strict/non-strict modes - Fix missing device_capabilities module in hanzo-network - Fix HanzoNetProvider imports and exports - Fix local_llm.py import errors - Create test helper classes for pagination tests - Fix FastMCP paginator test constructor args - Configure all API keys from ~/.zsh/after.zsh - All tests now pass or skip conditionally based on actual requirements
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
class ToolError(Exception):
|
|
"""Raised when a tool encounters an error."""
|
|
|
|
def __init__(self, message):
|
|
self.message = message
|
|
super().__init__(message)
|
|
|
|
def __str__(self):
|
|
return self.message
|
|
|
|
|
|
class EditorToolParameterMissingError(ToolError):
|
|
"""Raised when a required parameter is missing for a tool command."""
|
|
|
|
def __init__(self, command, parameter):
|
|
self.command = command
|
|
self.parameter = parameter
|
|
self.message = f"Parameter `{parameter}` is required for command: {command}."
|
|
|
|
|
|
class EditorToolParameterInvalidError(ToolError):
|
|
"""Raised when a parameter is invalid for a tool command."""
|
|
|
|
def __init__(self, parameter, value, hint=None):
|
|
self.parameter = parameter
|
|
self.value = value
|
|
self.message = (
|
|
f"Invalid `{parameter}` parameter: {value}. {hint}"
|
|
if hint
|
|
else f"Invalid `{parameter}` parameter: {value}."
|
|
)
|
|
|
|
|
|
class FileValidationError(ToolError):
|
|
"""Raised when a file fails validation checks (size, type, etc.)."""
|
|
|
|
def __init__(self, path: str, reason: str):
|
|
self.path = path
|
|
self.reason = reason
|
|
self.message = f"File validation failed for {path}: {reason}"
|
|
super().__init__(self.message)
|