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

Give better struct errors #1320

Merged
merged 1 commit into from
Dec 12, 2017
Merged

Give better struct errors #1320

merged 1 commit into from
Dec 12, 2017

Conversation

jeffwidman
Copy link
Collaborator

Stop shadowing the word error because we want to know what the specific exception message was.

Also give more details on exactly which value failed. We don't know who submitted the value, but perhaps it's unique enough that we can debug it better.

Fix #1318

@jeffwidman jeffwidman force-pushed the better-struct-errors branch from 6b7aabd to 60f5d5f Compare December 8, 2017 02:17
Stop shadowing the word `error` because we want to know what the
specific exception message was.

Also give more details on exactly which value failed. We don't know who
submitted the value, but perhaps it's unique enough that we can debug it better.

Fix #1318
@jeffwidman jeffwidman force-pushed the better-struct-errors branch from 60f5d5f to 54f12d4 Compare December 8, 2017 02:18
raise ValueError(error)
except error as e:
raise ValueError("Error encountered when attempting to convert value: "
"{} to struct format: '{}', hit error: {}"
Copy link
Collaborator

@tvoinarovskyi tvoinarovskyi Dec 8, 2017

Choose a reason for hiding this comment

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

Maybe {!r} for value just in case str is overridden.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I forgot to do this earlier, changed in #1373

@tvoinarovskyi
Copy link
Collaborator

Looks good.

@dpkp
Copy link
Owner

dpkp commented Dec 8, 2017

+1

@dpkp dpkp merged commit 68a416a into master Dec 12, 2017
@jeffwidman jeffwidman deleted the better-struct-errors branch December 12, 2017 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants