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 custom error message for using crc32c without crt #2905

Merged
merged 2 commits into from
Apr 11, 2023

Conversation

dlm6693
Copy link
Contributor

@dlm6693 dlm6693 commented Apr 10, 2023

Adds a custom error message for customers trying to use CRC32C checksum algorithm, but don't have awscrt installed.

@codecov-commenter
Copy link

codecov-commenter commented Apr 10, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (63d5d35) 93.54% compared to head (0c613c6) 93.55%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2905   +/-   ##
========================================
  Coverage    93.54%   93.55%           
========================================
  Files           63       63           
  Lines        13519    13521    +2     
========================================
+ Hits         12647    12650    +3     
+ Misses         872      871    -1     
Impacted Files Coverage Δ
botocore/httpchecksum.py 94.20% <100.00%> (+0.04%) ⬆️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@jonathan343 jonathan343 left a comment

Choose a reason for hiding this comment

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

Looks good to me! 🚀

@dlm6693 dlm6693 merged commit 2318884 into boto:develop Apr 11, 2023
@dlm6693 dlm6693 deleted the crc32c-no-crt branch April 11, 2023 17:14
Comment on lines +253 to +259
if algorithm_name == "crc32c" and not HAS_CRT:
raise FlexibleChecksumError(
error_msg=(
"Using CRC32C requires an additional dependency. You will "
"need to pip install botocore[crt] before proceeding."
)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a MissingDependencyError not a FlexibleChecksumError to stay consistent with our CRT exception messaging. See here for an example.

We also want to avoid hardcoding this for one algorithm. We should be able to have a defined list of algorithms supported by the CRT and check against that.

if algorithm_name not in supported_algorithms:
    if not HAS_CRT and algorithm_name in crt_algorithms:
        raise MissingDependencyError(
            error_msg=(
                f"Using {algorithm_name} requires an additional dependency. "
                f"You will need to pip install botocore[crt] before proceeding."
            )
        )  
    raise FlexibleChecksumError(
        error_msg="Unsupported checksum algorithm: %s" % algorithm_name
    )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I can open a followup PR. My only question is should CRC32 be included in crt_algorithms? Wondering because we have an implementation with and without the CRT.

Copy link
Contributor

Choose a reason for hiding this comment

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

Everything we support in the CRT can be in the list. We should assert that the dictionary keys we generate here are all in the list to keep everything in sync.

aws-sdk-python-automation added a commit that referenced this pull request Apr 11, 2023
* release-1.29.111:
  Bumping version to 1.29.111
  Update to latest partitions and endpoints
  Update to latest models
  add custom error message for using crc32c without crt (#2905)
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.

4 participants