-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: Standardize error message format in Rust code #11720
feat: Standardize error message format in Rust code #11720
Conversation
f208773
to
55c9f8f
Compare
afca905
to
c5f8aad
Compare
@stinodego I have added many Rust error standardization corrections. Could you have a look? Not sure why the ubuntu 3.11 python tests fail. I have not, as far as I can see, changed anything that would result in the failing of a test with a |
That's an unrelated bug caught by our parametric tests - don't worry about it! I'll review this soon. |
This is a nitpick, but could you remove the periods from the end of error messages? |
Most don't have a period, right? The help text should have proper punctuation though. See #10421 |
The single line messages shouldn't right? |
Correct. From the linked issue:
|
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.
A lot of improvements, but a lot of messages are now less clear because you stitched multi-sentence error messages together, instead of breaking them up into a short summary and a help text. Also, a lot of code snippets are still not in backticks.
This PR is too big for me to sit down and go through every example and correct the messages that I feel are regressions. Please break this up into multiple PRs, let's say one per crate, and really take care that the messages are high quality. Then we can actually get some of this work merged!
@@ -52,7 +52,7 @@ impl<O: Offset> ListArray<O> { | |||
let child_data_type = Self::try_get_child(&data_type)?.data_type(); | |||
let values_data_type = values.data_type(); | |||
if child_data_type != values_data_type { | |||
polars_bail!(ComputeError: "ListArray's child's DataType must match. However, the expected DataType is {child_data_type:?} while it got {values_data_type:?}."); | |||
polars_bail!(ComputeError: "ListArray's child's DataType must match, yet the expected DataType is {child_data_type:?} while it got {values_data_type:?}"); |
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.
This is too long for a single line error message. It should be broken up into a summary and a help text.
@@ -131,7 +131,7 @@ impl MapArray { | |||
if let DataType::Map(field, _) = data_type.to_logical_type() { | |||
Ok(field.as_ref()) | |||
} else { | |||
polars_bail!(ComputeError: "The data_type's logical type must be DataType::Map") | |||
polars_bail!(ComputeError: "the data_type's logical type must be DataType::Map") |
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.
Code snippets must be in backticks.
polars_bail!(ComputeError: "the data_type's logical type must be DataType::Map") | |
polars_bail!(ComputeError: "the data_type's logical type must be `DataType::Map`") |
Will do. @stinodego Would you like a separate PR for each crate? Name of crate in PR name? Also, what to do about package names? I see |
This code change updates all error messages in the rust part of polars package; see #10421