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

Add error handling for malfoemed author #1935

Merged
merged 3 commits into from
Jun 26, 2020

Conversation

yamagen0915
Copy link
Contributor

@yamagen0915 yamagen0915 commented Jan 23, 2020

Pull Request Check List

This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once, it will save you unnecessary review cycles!

  • Added tests for changed code.
  • Updated documentation for changed code.

Note: If your Pull Request introduces a new feature or changes the current behavior, it should be based
on the develop branch. If it's a bug fix or only a documentation update, it should be based on the master branch.

If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!

Issue

Fixes #1143.

In my case, I got the same error when I set empty string on author.

# poetry install
Installing dependencies from lock file

No dependencies to install or update


[AttributeError]
'NoneType' object has no attribute 'group'

I just fixed for now to return None.
Please tell me another approach if this is not appropriate fix.

@finswimmer finswimmer added the area/error-handling Bad error messages/insufficient error handling label Jan 24, 2020
@yamagen0915 yamagen0915 changed the title Fix error on invalid author Add error handling for malfoemed author Feb 7, 2020
Comment on lines 165 to 171
if m is None:
logger.warning(
"Invalid author string. Must be in the format: "
"John Smith <[email protected]>"
)
return {"name": None, "email": None}

Copy link
Member

Choose a reason for hiding this comment

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

Hello @yamagen0915,

thanks a lot for your contribution!

I think instead of just returning None values, we should raise a ValueError with your descriptive message. I'm afraid many users will not read the console output and will wonder why their author isn't in the metadata. So we should follow the principal of "fail fast".

fin swimmer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@finswimmer
Thanks for the review!
I have fixed. 6a0ac4a

@yamagen0915 yamagen0915 force-pushed the fix_getting_author_name branch from 3ca7541 to 6a0ac4a Compare June 26, 2020 08:56
Copy link
Member

@finswimmer finswimmer left a comment

Choose a reason for hiding this comment

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

Good job 👍 Thanks a lot.

@finswimmer finswimmer merged commit 413c07e into python-poetry:master Jun 26, 2020
@yamagen0915 yamagen0915 deleted the fix_getting_author_name branch June 27, 2020 11:47
malcolmgreaves pushed a commit to malcolmgreaves/pyprocut that referenced this pull request Jul 1, 2020
Copy link

github-actions bot commented Mar 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/error-handling Bad error messages/insufficient error handling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poetry fails with intenral error on malformed author
2 participants