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

Fix assert statements and deprecated logger.warn's #486

Merged

Conversation

bvavala
Copy link
Member

@bvavala bvavala commented Apr 23, 2024

This PR addresses #288 and #484 .

bvavala added 2 commits April 23, 2024 19:31
…he error handling/reporting

Signed-off-by: Bruno Vavala <bruno.vavala@intel.com>
Signed-off-by: Bruno Vavala <bruno.vavala@intel.com>
Copy link
Contributor

@cmickeyb cmickeyb left a comment

Choose a reason for hiding this comment

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

abort should only be used for a programmer error, not an environment error. please replace with one of the standard exceptions.

@@ -76,7 +77,7 @@ def verify_store_signature(store_response, duration, verifying_key) :
result = client.store_blocks([block_data], duration=default_duration)
assert result

assert verify_store_signature(result, default_duration, client.verifying_key)
assert (1 == verify_store_signature(result, default_duration, client.verifying_key))

Copy link
Contributor

@cmickeyb cmickeyb Apr 23, 2024

Choose a reason for hiding this comment

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

why are we using assert here? it pretty much blows up the entire application. can we just use the existing exceptions? the whole value of returning multiple values is to distinguish between invalid and error but you are throwing the same error both ways; as in this tells it breaks but not why

@@ -109,7 +110,7 @@ def verify_store_signature(store_response, duration, verifying_key) :
result = client.store_blocks(block_data, duration=default_duration)
assert result

assert verify_store_signature(result, default_duration, client.verifying_key)
assert (1 == verify_store_signature(result, default_duration, client.verifying_key))

Copy link
Contributor

Choose a reason for hiding this comment

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

same. this is pretty draconian.

@bvavala
Copy link
Member Author

bvavala commented Apr 23, 2024

abort should only be used for a programmer error, not an environment error. please replace with one of the standard exceptions.

I have changed the assert's in the file with raises's.

Signed-off-by: Bruno Vavala <bruno.vavala@intel.com>
@bvavala bvavala force-pushed the bruno.240423.fix-asserts-and-warns branch from 5416289 to e6e5088 Compare April 23, 2024 22:45
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