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

No detail in ReductError exception #51

Merged
merged 4 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed:

- `client.get_bucket` now uses `GET` instead of `HEAD` in order to be able to return a meaningful error to the user, [PR-51](https://github.com/reduct-storage/reduct-py/pull/51)

## [v1.0.0] - 2022-10-18

### Added:
Expand Down
2 changes: 1 addition & 1 deletion pkg/reduct/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def get_bucket(self, name: str) -> Bucket:
Raises:
ReductError: if there is an HTTP error
"""
await self._http.request_all("HEAD", f"/b/{name}")
await self._http.request_all("GET", f"/b/{name}")
atimin marked this conversation as resolved.
Show resolved Hide resolved
return Bucket(name, self._http)

async def create_bucket(
Expand Down
3 changes: 2 additions & 1 deletion tests/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ async def test__get_bucket(client):
@pytest.mark.asyncio
async def test__get_bucket_with_error(client):
"""Should raise an error, if bucket doesn't exist"""
with pytest.raises(ReductError):
with pytest.raises(ReductError) as reduct_err:
await client.get_bucket("NOTEXIST")
assert "Status 404: Bucket 'NOTEXIST' is not found" == str(reduct_err.value)


def test__exception_formatting():
Expand Down