-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat(python)!: Improve some error types and messages #10470
Conversation
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.
Thanks for the effort! Though I definitely see some issues still - messages that start with a capital letter, or mistakenly added newlines.
I'll put this on draft, just mark it ready-to-review when you've made a pass to verify your changes!
Nice one! I was going to look at this but you're off to a great start - go for it :)) |
Out of curiosity, would we benefit from an error-helper function, or is this too much indirection? Something like pl.exceptions.raise(
"ValueError",
header="polars can not currently guarantee zero-copy conversion from Arrow for categorical columns",
desc="Set `allow_copy=True` or cast categorical columns to string first."
) Which could then ensure proper formatting, and insert newlines where appropriate? |
Perhaps, but it would find its way into the reported stack which isn't ideal 🤔 |
@alexander-beedie there are ways to modify the traceback with the |
Indeed; doing "clever" things with your exceptions IN your exception handling code is something I'm not a big fan of ;) |
670cff9
to
761b1f4
Compare
76b73dd
to
4371c4d
Compare
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.
Nice improvement! Congrats on your first contribution 🎉
I did have to fix a few false positives, and there are many messages that still do not conform to the guidelines. Plus the same improvements should be done on the Rust side. So the linked issue remains open for now.
If you wish to continue to work on the issue, I would advise a more concentrated approach: pick a module and make sure all error messages are perfect. That way, it's easier for us to review.
@aminalaee 55 files changed! Good job here. We all encounter error messages every day so this is a nice improvement :) |
Thanks for the review and kind words. msg = “Invalid operation”
raise ValueError(msg) |
Partially addresses #10421
Changes: