Skip to content

Commit 8cdc9f4

Browse files
committed
move invalidapiusage call up to service level
1 parent 4dcdbf8 commit 8cdc9f4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

app/services/validation_service.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
check_ro_crate_exists
1717
)
1818

19+
from app.utils.config import InvalidAPIUsage
20+
21+
1922
logger = logging.getLogger(__name__)
2023

2124

@@ -36,6 +39,9 @@ def queue_ro_crate_validation_task(
3639

3740
if check_ro_crate_exists(crate_id):
3841
logging.info("RO-Crate exists")
42+
else:
43+
logging.info("RO-Crate does not exist")
44+
raise InvalidAPIUsage(f"No RO-Crate with prefix: {crate_id}", 400)
3945

4046
try:
4147
process_validation_task_by_id.delay(crate_id, profile_name, webhook_url)

0 commit comments

Comments
 (0)