-
Notifications
You must be signed in to change notification settings - Fork 75.2k
fixed error messages and inconsistent if-condition-raise statements #58589
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
Conversation
rohan100jain
left a comment
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.
In general, lets keep it as ValueError but thanks for improving the error messages!
| raise ValueError("Incorrect number of elements in range") | ||
| elif not isinstance(item[0], (int, float)): | ||
| raise ValueError("Incorrect type in the 1st element of range: %s" % | ||
| raise TypeError("Incorrect type in the 1st element of range: %s" % |
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.
Lets keep these as ValueError? Or we'll have to update the Raises: section as well. Typically in TF we just throw ValueError for any input validation problems.
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.
Oh, I see, I was just following the Python documentation :
ValueError
Raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError.
| type(item[0])) | ||
| elif not isinstance(item[1], (int, float)): | ||
| raise ValueError("Incorrect type in the 2nd element of range: %s" % | ||
| raise TypeError("Incorrect type in the 2nd element of range: %s" % |
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.
ditto
| command_parser.parse_ranges("[inf]") | ||
|
|
||
| with self.assertRaisesRegex(ValueError, | ||
| with self.assertRaisesRegex(TypeError, |
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.
Lets keep it as ValueError
|
@islem-esi Can you please resolve conflicts? Thank you! |
|
There are still a couple of TypeError's that should become ValueErrors |
|
Hi @islem-esi Can you please check @rohan100jain's comments and keep us posted ? Thank you! |
|
This PR is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you. |
|
This PR was closed because it has been inactive for 14 days since being marked as stale. Please reopen if you'd like to work on this further. |
No description provided.