Exceptions¶
The GazeError hierarchy raised across the library. Catch specific subtypes
rather than the base class so that distinct failures (model errors, schema
validation, tool failures) can be handled separately.
exceptions ¶
Exceptions for GAZE.
GazeError ¶
ToolExecutionError ¶
Bases: GazeError
Raised when a tool execution fails due to invalid state or parameters.
Attributes:
| Name | Type | Description |
|---|---|---|
tool_name |
Name of the tool that failed (if known) |
|
tool_args |
Arguments passed to the tool (if available) |
Source code in src/gaze/exceptions.py
TemplateError ¶
Bases: GazeError
Raised when template loading or rendering fails.
Chain with raise TemplateError(...) from original so that
__cause__ preserves the root error automatically.
Attributes:
| Name | Type | Description |
|---|---|---|
template_path |
Path to the template that failed |
Source code in src/gaze/exceptions.py
UnknownToolError ¶
Bases: GazeError
Raised when an unknown tool is requested.
Attributes:
| Name | Type | Description |
|---|---|---|
tool_name |
The name of the unknown tool |
|
available_tools |
tuple[str, ...]
|
Frozen tuple of available tool names |
Source code in src/gaze/exceptions.py
AgenticProcessingError ¶
Bases: GazeError
Raised when agentic processing fails.
Attributes:
| Name | Type | Description |
|---|---|---|
turns_completed |
Number of turns completed before failure |
|
partial_response |
Partial response if available |
Source code in src/gaze/exceptions.py
SchemaValidationError ¶
Bases: AgenticProcessingError
Raised when a response fails schema validation.
Subclasses :class:AgenticProcessingError (not :class:GazeError
directly), so it also carries turns_completed and partial_response.
Catching AgenticProcessingError handles both.
Attributes:
| Name | Type | Description |
|---|---|---|
turns_completed |
Number of turns completed before the invalid response |
|
missing_fields |
List of missing required fields |
|
response |
The invalid response |
Source code in src/gaze/exceptions.py
ModelError ¶
APIError ¶
Bases: ModelError
Raised when API calls fail.
Note: This exception deliberately does NOT store the raw API response body. OpenAI/OpenRouter error responses may echo back request headers or URLs that contain API keys.