Skip to content

Commit e64e41f

Browse files
committed
Fixed: Unsupported score sets not handled by decorator
1 parent d28ce73 commit e64e41f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/dcd_mapping/mavedb_data.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from typing import Any
1515

1616
import requests
17+
from fastapi import HTTPException
1718
from pydantic import ValidationError
1819

1920
from dcd_mapping.resource_utils import (
@@ -283,8 +284,17 @@ async def wrapper(*args, **kwargs) -> ScoresetMapping: # noqa: ANN002
283284
# Set up metadata and scores for the current run. Now they will be accessible by these functions
284285
# without the need to download the data again.
285286
temp_dir_as_path = Path(temp_dir)
286-
get_scoreset_metadata(urn, temp_dir_as_path)
287-
get_scoreset_records(urn, silent, temp_dir_as_path)
287+
try:
288+
get_scoreset_metadata(urn, temp_dir_as_path)
289+
get_scoreset_records(urn, silent, temp_dir_as_path)
290+
except ScoresetNotSupportedError as e:
291+
return ScoresetMapping(
292+
metadata=None,
293+
error_message=str(e).strip("'"),
294+
)
295+
except ResourceAcquisitionError as e:
296+
msg = f"Unable to acquire resource from MaveDB: {e}"
297+
raise HTTPException(status_code=500, detail=msg) from e
288298

289299
# Pass the storage path of the temp directory to the wrapped function as a kwarg.
290300
kwargs["store_path"] = temp_dir_as_path

0 commit comments

Comments
 (0)