-
Notifications
You must be signed in to change notification settings - Fork 0
Chore: [GSK-4543] Introduce specific error classes (e.g., CounterpointConfigError) #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
c6cf087
1271658
c2d51fb
0885099
86557f4
477b678
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| """Counterpoint-specific exception classes. | ||
|
|
||
| These exceptions provide clearer error semantics for configuration, | ||
| template, tool, parsing, and pipeline related issues compared to using | ||
| generic built-ins. | ||
| """ | ||
|
|
||
|
|
||
| class CounterpointError(Exception): | ||
| """Base class for all Counterpoint errors.""" | ||
|
|
||
|
|
||
| class CounterpointConfigError(CounterpointError): | ||
| """Raised for invalid or missing configuration/state in Counterpoint.""" | ||
|
|
||
|
|
||
| class ToolError(CounterpointError): | ||
| """Base class for tool-related errors.""" | ||
|
|
||
|
|
||
| class ToolDefinitionError(ToolError): | ||
| """Raised when a tool is defined incorrectly (e.g., bad annotations).""" | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,9 @@ async def test_multi_message_template_parsing(prompts_manager): | |
|
|
||
|
|
||
| async def test_invalid_template(prompts_manager): | ||
| with pytest.raises(ValueError): | ||
| from counterpoint.exceptions import CounterpointConfigError | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to PEP 8, imports should usually be at the top of the file. This local import should be moved to the top-level imports to improve code style and maintain consistency with other files in the project (e.g., |
||
|
|
||
| with pytest.raises(CounterpointConfigError): | ||
| await prompts_manager.render_template("invalid.j2") | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better readability and consistency, it's good practice to sort imports. In this case, sorting them logically by hierarchy would be best, with base classes appearing before their subclasses. This also makes the import order consistent with the order in
__all__.