Skip to content

CLN: Fix exception causes in datetimelike.py #32164

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

Merged
merged 1 commit into from
Feb 25, 2020

Conversation

cool-RR
Copy link
Contributor

@cool-RR cool-RR commented Feb 21, 2020

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@pep8speaks
Copy link

pep8speaks commented Feb 21, 2020

Hello @cool-RR! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-02-21 22:29:14 UTC

@cool-RR cool-RR force-pushed the 2020-02-21-datetimelike branch from b471854 to 668f774 Compare February 21, 2020 21:22
@cool-RR cool-RR force-pushed the 2020-02-21-datetimelike branch from 668f774 to ca30a8d Compare February 21, 2020 22:29
except ValueError as e:
raise TypeError(
"searchsorted requires compatible dtype or scalar"
) from e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: can you make this "err" instead of "e"; i really dont like 1-letter names

Copy link
Member

@gfyoung gfyoung Feb 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh...I would leave it alone for this PR. I understand having an aesthetic preference, but e (as an exception variable name) is strewn all over the place in this file, and I don't see why we should nitpick this one instance and hold this PR up because of that.

If we have a generally accepted (for this repository) a stylistic preference for variable names for exceptions, then fine, but I'm not aware of that at this point.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah, not a deal-breaker. i think of this as a "if you have to push another commit anyway, this would be nice"

@gfyoung gfyoung added Clean Error Reporting Incorrect or improved errors from pandas labels Feb 22, 2020
@cool-RR cool-RR marked this pull request as ready for review February 22, 2020 10:30
@cool-RR
Copy link
Contributor Author

cool-RR commented Feb 22, 2020

Thanks for reviewing guys. I'm ambivalent towards the err change, so if you'd like me to change, I'll change it. If there's anything else I need to do about this PR, let me know.

@gfyoung
Copy link
Member

gfyoung commented Feb 22, 2020

Thanks @cool-RR, and welcome to pandas! 🎉

err naming question notwithstanding, it looks good!

@jbrockmendel
Copy link
Member

@cool-RR is there something here we should be testing?

@cool-RR
Copy link
Contributor Author

cool-RR commented Feb 22, 2020

If you mean testing that the __cause__ attribute is set correctly, I think that's overkill. The only kind of testing that's useful is having test code that causes the exception, reaches the raise and ensures the correct exception gets raised, but that's orthogonal to this PR, i.e. it's needed about as much as it's needed without this PR.

@jbrockmendel
Copy link
Member

sounds good, LGTM

@cool-RR
Copy link
Contributor Author

cool-RR commented Feb 24, 2020

Cool. Any next steps needed before merging?

@WillAyd WillAyd added this to the 1.1 milestone Feb 25, 2020
@WillAyd
Copy link
Member

WillAyd commented Feb 25, 2020

I would be on board with doing this more generally if there's a way to identify easily

@WillAyd WillAyd merged commit 241bf60 into pandas-dev:master Feb 25, 2020
@WillAyd
Copy link
Member

WillAyd commented Feb 25, 2020

Thanks @cool-RR

roberthdevries pushed a commit to roberthdevries/pandas that referenced this pull request Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants