Skip to content

Commit 9044d22

Browse files
committed
give more info on error
1 parent c0fc89b commit 9044d22

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

packages/simcore-sdk/src/simcore_sdk/node_ports_common/storage_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,13 @@ async def retry_request(
121121
async with _session_method(session, method, url, **kwargs) as response:
122122
if response.status != expected_status:
123123
# this is a more precise raise_for_status()
124+
error_msg = await response.json()
124125
response.release()
125126
raise ClientResponseError(
126127
response.request_info,
127128
response.history,
128129
status=response.status,
129-
message=f"Received {response.status} but was expecting {expected_status=}",
130+
message=f"Received {response.status} but was expecting {expected_status=}: '{error_msg=}'",
130131
headers=response.headers,
131132
)
132133

@@ -211,7 +212,7 @@ async def get_upload_file_links(
211212
async with retry_request(
212213
session,
213214
"PUT",
214-
f"{get_base_url()}/locations/{location_id}/files/{quote(file_id, safe='')}",
215+
f"{get_base_url()}/locations/{location_id}/files/{file_id}",
215216
expected_status=status.HTTP_200_OK,
216217
params=query_params,
217218
) as response:

packages/simcore-sdk/tests/integration/test_node_ports_common_filemanager.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,8 @@ async def test_errors_upon_invalid_file_identifiers(
394394
assert file_path.exists()
395395

396396
store = s3_simcore_location
397-
with pytest.raises(exceptions.S3InvalidPathError): # noqa: PT012
398-
invalid_s3_path = SimcoreS3FileID("")
397+
with pytest.raises(exceptions.StorageInvalidCall): # noqa: PT012
398+
invalid_s3_path = ""
399399
await filemanager.upload_path(
400400
user_id=user_id,
401401
store_id=store,
@@ -406,7 +406,7 @@ async def test_errors_upon_invalid_file_identifiers(
406406
)
407407

408408
with pytest.raises(exceptions.StorageInvalidCall): # noqa: PT012
409-
invalid_file_id = SimcoreS3FileID("file_id")
409+
invalid_file_id = "file_id"
410410
await filemanager.upload_path(
411411
user_id=user_id,
412412
store_id=store,
@@ -417,11 +417,11 @@ async def test_errors_upon_invalid_file_identifiers(
417417
)
418418

419419
download_folder = Path(tmpdir) / "downloads"
420-
with pytest.raises(exceptions.S3InvalidPathError): # noqa: PT012
420+
with pytest.raises(exceptions.StorageInvalidCall): # noqa: PT012
421421
async with ProgressBarData(
422422
num_steps=1, description=IDStr(faker.pystr())
423423
) as progress_bar:
424-
invalid_s3_path = SimcoreS3FileID("")
424+
invalid_s3_path = ""
425425
await filemanager.download_path_from_s3(
426426
user_id=user_id,
427427
store_id=store,
@@ -594,13 +594,19 @@ async def test_invalid_call_raises_exception(
594594

595595
with pytest.raises(exceptions.StorageInvalidCall):
596596
await fct(
597-
user_id=None, store_id=s3_simcore_location, s3_object=file_id, **extra_kwargs # type: ignore
597+
user_id=None,
598+
store_id=s3_simcore_location,
599+
s3_object=file_id,
600+
**extra_kwargs, # type: ignore
598601
)
599602
with pytest.raises(exceptions.StorageInvalidCall):
600603
await fct(user_id=user_id, store_id=None, s3_object=file_id, **extra_kwargs) # type: ignore
601604
with pytest.raises(exceptions.StorageInvalidCall):
602605
await fct(
603-
user_id=user_id, store_id=s3_simcore_location, s3_object="bing", **extra_kwargs # type: ignore
606+
user_id=user_id,
607+
store_id=s3_simcore_location,
608+
s3_object="bing",
609+
**extra_kwargs, # type: ignore
604610
)
605611

606612

0 commit comments

Comments
 (0)