Skip to content

Commit 9353e58

Browse files
committed
use FailedPreCondition instead of NotFound
1 parent f1abcaa commit 9353e58

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

google/cloud/storage/_experimental/asyncio/_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ def raise_if_no_fast_crc32c():
2020
"""Check if the C-accelerated version of google-crc32c is available.
2121
2222
If not, raise an error to prevent silent performance degradation.
23-
24-
raises google.api_core.exceptions.NotFound: If the C extension is not available.
23+
24+
raises google.api_core.exceptions.FailedPrecondition: If the C extension is not available.
2525
returns: True if the C extension is available.
2626
rtype: bool
2727
2828
"""
2929
if google_crc32c.implementation != "c":
30-
raise exceptions.NotFound(
30+
raise exceptions.FailedPrecondition(
3131
"The google-crc32c package is not installed with C support. "
32-
"Bidi reads require the C extension for data integrity checks."
32+
"C extension is required for faster data integrity checks."
3333
"For more information, see https://github.com/googleapis/python-crc32c."
3434
)

tests/unit/asyncio/test_async_appendable_object_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def test_init_raises_if_crc32c_c_extension_is_missing(
9595
):
9696
mock_google_crc32c.implementation = "python"
9797

98-
with pytest.raises(exceptions.NotFound) as exc_info:
98+
with pytest.raises(exceptions.FailedPrecondition) as exc_info:
9999
AsyncAppendableObjectWriter(mock_grpc_client, "bucket", "object")
100100

101101
assert "The google-crc32c package is not installed with C support" in str(

tests/unit/asyncio/test_async_multi_range_downloader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def test_init_raises_if_crc32c_c_extension_is_missing(
358358
):
359359
mock_google_crc32c.implementation = "python"
360360

361-
with pytest.raises(exceptions.NotFound) as exc_info:
361+
with pytest.raises(exceptions.FailedPrecondition) as exc_info:
362362
AsyncMultiRangeDownloader(mock_grpc_client, "bucket", "object")
363363

364364
assert "The google-crc32c package is not installed with C support" in str(

0 commit comments

Comments
 (0)