Skip to content
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

Use more appropriate error variants in various places across the API #16440

Closed
stinodego opened this issue May 23, 2024 · 2 comments · Fixed by #15030
Closed

Use more appropriate error variants in various places across the API #16440

stinodego opened this issue May 23, 2024 · 2 comments · Fixed by #15030
Assignees
Labels
A-api Area: changes to the public API A-exceptions Area: exception handling accepted Ready for implementation enhancement New feature or an improvement of an existing feature
Milestone

Comments

@stinodego
Copy link
Member

stinodego commented May 23, 2024

We often use ComputeError as a default, but we have a bunch of different error types available. Sometimes using a different error type is more appropriate, such as a DuplicateError or SchemaError.

On the Python side, there is also the occasional ValueError that should be a TypeError and similar.

Please comment here with any errors that you know/feel are incorrect (ideally include a code example that triggers the error), and I will update #15030 accordingly. Then this can be updated in one breaking PR.

@stinodego stinodego added enhancement New feature or an improvement of an existing feature accepted Ready for implementation A-api Area: changes to the public API A-exceptions Area: exception handling labels May 23, 2024
@stinodego stinodego added this to the 1.0.0 milestone May 23, 2024
@stinodego stinodego self-assigned this May 23, 2024
@s-banach
Copy link
Contributor

Can you tell me how to import exceptions in a way the type-checker will understand?
I guess they're imported from polars.polars, but the type checker is greyed-out on polars.polars.

@stinodego
Copy link
Member Author

Can you tell me how to import exceptions in a way the type-checker will understand? I guess they're imported from polars.polars, but the type checker is greyed-out on polars.polars.

They are available on top-level, so you can use pl.ComputeError. Or you can from polars.exceptions import ComputeError and then use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-api Area: changes to the public API A-exceptions Area: exception handling accepted Ready for implementation enhancement New feature or an improvement of an existing feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants