From 692397503f4a475168b92a8d5d8cda7719d2bf65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20Rein=C3=B3n?= Date: Fri, 29 Apr 2022 00:54:48 +0200 Subject: [PATCH] feat: add statusCode to exception --- storage3/_async/bucket.py | 2 +- storage3/_async/file_api.py | 2 +- storage3/_sync/bucket.py | 2 +- storage3/_sync/file_api.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/storage3/_async/bucket.py b/storage3/_async/bucket.py index 3e79917e..6cbe4a99 100644 --- a/storage3/_async/bucket.py +++ b/storage3/_async/bucket.py @@ -31,7 +31,7 @@ async def _request( try: response.raise_for_status() except HTTPError: - raise StorageException(response.json()) + raise StorageException({**response.json(), "statusCode": response.status_code}) return response diff --git a/storage3/_async/file_api.py b/storage3/_async/file_api.py index 3c3235ea..009cb97f 100644 --- a/storage3/_async/file_api.py +++ b/storage3/_async/file_api.py @@ -35,7 +35,7 @@ async def _request( try: response.raise_for_status() except HTTPError: - raise StorageException(response.json()) + raise StorageException({**response.json(), "statusCode": response.status_code}) return response diff --git a/storage3/_sync/bucket.py b/storage3/_sync/bucket.py index ef48db43..072e29ae 100644 --- a/storage3/_sync/bucket.py +++ b/storage3/_sync/bucket.py @@ -31,7 +31,7 @@ def _request( try: response.raise_for_status() except HTTPError: - raise StorageException(response.json()) + raise StorageException({**response.json(), "statusCode": response.status_code}) return response diff --git a/storage3/_sync/file_api.py b/storage3/_sync/file_api.py index 337c28ae..a90c7310 100644 --- a/storage3/_sync/file_api.py +++ b/storage3/_sync/file_api.py @@ -35,7 +35,7 @@ def _request( try: response.raise_for_status() except HTTPError: - raise StorageException(response.json()) + raise StorageException({**response.json(), "statusCode": response.status_code}) return response