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

Make check_match() errors more readable for ListOf objects #199

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

joshuagl
Copy link
Collaborator

@joshuagl joshuagl commented Jan 6, 2020

Please fill in the fields below to submit a pull request. The more information
that is provided, the better.

Fixes issue #194:

Description of the changes being introduced by the pull request:

When the ListOf object's check_match() fails due to an incompatible object
having been passed, the salient information for the error message is the
type of the passed object and the type of the object against which the
check_match() method was called, therefore print those types in the error
message and not the string representation of the objects.

Please verify and check that the pull request fulfills the following
requirements
:

  • The code follows the Code Style Guidelines
  • Tests have been added for the bug fix or new feature
  • Docs have been added for the bug fix or new feature

securesystemslib/schema.py Outdated Show resolved Hide resolved
Copy link
Member

@lukpueh lukpueh left a comment

Choose a reason for hiding this comment

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

Thank you very much for the patch, @joshuagl! I have left a few comments in line. Let me know what you think.

@joshuagl
Copy link
Collaborator Author

joshuagl commented Jan 6, 2020

Thanks for the incisive feedback. I've force-pushed an updated patch to address your two primary comments.

As I understand it we can not switch to the new style string formatting until we drop Python 2 support, which I understood to be something we don't want to rush into.

When the ListOf object's check_match() fails due to an incompatible object
having been passed, the salient information for the error message is the
type of the passed object and the type of the object against which the
check_match() method was called, therefore print those types in the error
message and not the string representation of the objects.

Fixes secure-systems-lab#194

Signed-off-by: Joshua Lock <[email protected]>
Copy link
Member

@lukpueh lukpueh left a comment

Choose a reason for hiding this comment

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

💯

@lukpueh lukpueh merged commit 6664328 into secure-systems-lab:master Jan 6, 2020
@joshuagl joshuagl deleted the joshuagl/issue194 branch January 6, 2020 14:56
@lukpueh lukpueh mentioned this pull request Jan 30, 2020
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.

2 participants