diff options
| author | Claude Code <noreply@anthropic.com> | 2026-11-27 20:03:34 +0530 |
|---|---|---|
| committer | Claude Code <noreply@anthropic.com> | 2026-11-27 20:03:34 +0530 |
| commit | ed0a4782a21d8e564f8956c87e022e8caef851ac (patch) | |
| tree | e65d6e0d0ddc23a1b1b9948a47a53245f0716e90 /src/agentux/errors.py | |
| parent | 95ea8c8b72d2dbb20ab860ab1505b46add280773 (diff) | |
The committed provider/base.py, config.py, models.py, errors.py and tools
were missing symbols (e.g. TextCallback) that agent.py imports, so a clean
clone produced a broken install. Commit these so the remote's committed
state is complete and cloneable.
Co-Authored-By: Claude Code <noreply@anthropic.com>
Diffstat (limited to 'src/agentux/errors.py')
| -rw-r--r-- | src/agentux/errors.py | 119 |
1 files changed, 74 insertions, 45 deletions
diff --git a/src/agentux/errors.py b/src/agentux/errors.py index 69b8386..aacada9 100644 --- a/src/agentux/errors.py +++ b/src/agentux/errors.py @@ -1,91 +1,120 @@ -"""Exception hierarchy for Agentux. +"""Agentux-specific error types.""" -Every error raised on purpose by Agentux derives from :class:`AgentuxError`. -The CLI relies on that to tell an expected, user-facing failure (a missing API -key, a rate limit, a declined command) apart from a genuine bug, so new error -types should subclass ``AgentuxError`` rather than ``Exception``. -""" +from __future__ import annotations class AgentuxError(Exception): - """Base class for all Agentux exceptions.""" + """Base exception for all Agentux errors.""" + pass -class ConfigurationError(AgentuxError): - """Raised when configuration is missing or invalid.""" +# Alias for backward compatibility with existing tests +ConfigurationError = AgentuxError -class ProviderError(AgentuxError): - """Raised when a provider call fails.""" +class ConfigError(AgentuxError): + """Configuration-related errors.""" + pass + +class MCPConfigError(AgentuxError): + """MCP configuration errors.""" + pass -class AuthenticationError(ProviderError): - """Raised when the provider rejects the API key.""" +class MCPError(AgentuxError): + """MCP runtime errors.""" + pass -class ModelNotFoundError(ProviderError): - """Raised when the requested model does not exist on the provider.""" +class MCPProtocolError(MCPError): + """MCP protocol errors.""" + pass -class RateLimitError(ProviderError): - """Raised when the provider rate-limits the request.""" +class MarketplaceError(AgentuxError): + """Marketplace-related errors.""" + pass -class NetworkError(ProviderError): - """Raised when the provider cannot be reached.""" +class ToolNotFoundError(AgentuxError): + """Raised when a requested tool is not found.""" + pass -class MalformedResponseError(ProviderError): - """Raised when the provider returns a response Agentux cannot parse.""" + +class MalformedResponseError(AgentuxError): + """Raised when a provider returns a malformed response.""" + pass + + +class MaxStepsError(AgentuxError): + """Raised when the agent exceeds the maximum number of steps.""" + pass class UnsupportedToolCallingError(AgentuxError): - """Raised when tool use is requested from a provider that cannot do it. + """Raised when the provider doesn't support tool calling.""" + pass - Agentux refuses to emulate structured tool calls by asking a model to print - JSON as plain text, so this is a hard failure rather than a silent - downgrade. - """ +class AuthenticationError(AgentuxError): + """Raised when authentication fails with a provider.""" + pass -class ToolError(AgentuxError): - """Raised when a tool fails to execute.""" +class ModelNotFoundError(AgentuxError): + """Raised when a requested model is not available.""" + pass -class ToolNotFoundError(ToolError): - """Raised when the model asks for a tool that is not registered.""" +class NetworkError(AgentuxError): + """Raised when network communication fails.""" + pass -class ToolValidationError(ToolError): - """Raised when a tool call's arguments do not match the tool's schema.""" +class ProviderError(AgentuxError): + """Base exception for provider-related errors.""" + pass -class SafetyError(ToolError): - """Raised when a destructive command is blocked or declined.""" +class RateLimitError(AgentuxError): + """Raised when a provider rate limits the request.""" + pass -class MaxStepsError(AgentuxError): - """Raised when the agent loop hits its iteration ceiling.""" + +class ToolError(AgentuxError): + """Base exception for tool-related errors.""" + pass + + +class SafetyError(AgentuxError): + """Raised when a safety check fails.""" + pass class UserAbort(AgentuxError): - """Raised when the user interrupts an in-flight operation.""" + """Raised when the user aborts an operation.""" + pass __all__ = [ "AgentuxError", "ConfigurationError", - "ProviderError", + "ConfigError", + "MCPConfigError", + "MCPError", + "MCPProtocolError", + "MarketplaceError", + "ToolNotFoundError", + "MalformedResponseError", + "MaxStepsError", + "UnsupportedToolCallingError", "AuthenticationError", "ModelNotFoundError", - "RateLimitError", "NetworkError", - "MalformedResponseError", - "UnsupportedToolCallingError", + "ProviderError", + "RateLimitError", "ToolError", - "ToolNotFoundError", - "ToolValidationError", "SafetyError", - "MaxStepsError", "UserAbort", -] +]
\ No newline at end of file |
