Skip to content

Commit

Permalink
Fix __str__ of b2sdk.v2.BucketIdNotFound to return full error mes…
Browse files Browse the repository at this point in the history
…sage and not just missing bucket ID value.
  • Loading branch information
mjurbanski-reef committed May 9, 2024
1 parent 3bb7f33 commit a746994
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion b2sdk/v2/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ def __init__(self, bucket_id):
self.code = 'bad_bucket_id'

def __str__(self):
return super(BadRequest, self).__str__()
return BadRequest.__str__(self)
1 change: 1 addition & 0 deletions changelog.d/+fix_str_of_v2_BucketIdNotFound.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `__str__` of `b2sdk.v2.BucketIdNotFound` to return full error message and not just missing bucket ID value.
4 changes: 3 additions & 1 deletion test/unit/b2http/test_b2http.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ def test_bucket_id_not_found(self):
def fcn():
raise v3BucketIdNotFound('bucket_id')

with pytest.raises(BucketIdNotFound):
with pytest.raises(BucketIdNotFound) as exc_info:
B2Http._translate_errors(fcn)

assert str(exc_info.value) == 'Bucket with id=bucket_id not found (bad_bucket_id)'


def test_b2_error__nginx_html():
"""
Expand Down

0 comments on commit a746994

Please sign in to comment.