diff --git a/src/regtech_cleanup_api/routers/cleanup.py b/src/regtech_cleanup_api/routers/cleanup.py index f29fcf0..7ac5507 100644 --- a/src/regtech_cleanup_api/routers/cleanup.py +++ b/src/regtech_cleanup_api/routers/cleanup.py @@ -54,8 +54,8 @@ def delete_all_things(request: Request, lei: str): if not is_valid_cleanup_lei(lei): raise RegTechHttpException( HTTPStatus.NOT_ACCEPTABLE, - name="Not Test LEI", - detail=f"{lei} not valid test lei.", + name="Invalid LEI", + detail=f"Not a valid LEI {lei}", ) else: institution_delete_helper(lei, request.state.institution_db_session) diff --git a/src/regtech_cleanup_api/routers/filing_cleanup.py b/src/regtech_cleanup_api/routers/filing_cleanup.py index 6f7cdaa..d331729 100644 --- a/src/regtech_cleanup_api/routers/filing_cleanup.py +++ b/src/regtech_cleanup_api/routers/filing_cleanup.py @@ -35,7 +35,7 @@ def delete_filing(request: Request, lei: str, period_code: str): raise RegTechHttpException( status_code=HTTPStatus.NOT_ACCEPTABLE, name="Invalid LEI", - detail="Not a valid LEI", + detail=f"Not a valid LEI {lei}", ) else: try: @@ -57,7 +57,7 @@ def delete_helper(lei: str, period_code: str, session: Session): raise RegTechHttpException( status_code=HTTPStatus.INTERNAL_SERVER_ERROR, name="Contact Info Delete Failed", - detail="Failed to delete contact info", + detail=f"Failed to delete contact info for LEI {lei}", ) from e try: @@ -66,7 +66,7 @@ def delete_helper(lei: str, period_code: str, session: Session): raise RegTechHttpException( status_code=HTTPStatus.INTERNAL_SERVER_ERROR, name="Missing User Action Data", - detail="Failed to get user action data", + detail=f"Failed to get user action data for LEI {lei}", ) from e try: @@ -75,7 +75,7 @@ def delete_helper(lei: str, period_code: str, session: Session): raise RegTechHttpException( status_code=HTTPStatus.INTERNAL_SERVER_ERROR, name="Submission Delete Failed", - detail="Failed to delete submission data", + detail=f"Failed to delete submission data for LEI {lei}", ) from e try: @@ -84,7 +84,7 @@ def delete_helper(lei: str, period_code: str, session: Session): raise RegTechHttpException( status_code=HTTPStatus.INTERNAL_SERVER_ERROR, name="Filing Delete Failed", - detail="Failed to delete filing data", + detail=f"Failed to delete filing data for LEI {lei}", ) from e try: @@ -93,7 +93,7 @@ def delete_helper(lei: str, period_code: str, session: Session): raise RegTechHttpException( status_code=HTTPStatus.INTERNAL_SERVER_ERROR, name="User Action Delete Failed", - detail="Failed to delete user action data", + detail=f"Failed to delete user action data for LEI {lei}", ) from e delete_from_storage(period_code, lei) @@ -112,7 +112,7 @@ def delete_submissions(request: Request, lei: str, period_code: str): raise RegTechHttpException( status_code=HTTPStatus.INTERNAL_SERVER_ERROR, name="Missing User Action Data", - detail="Failed to get user action data", + detail=f"Failed to get user action data for LEI {lei}", ) from e try: repo.delete_submissions(session, lei, period_code) @@ -120,7 +120,7 @@ def delete_submissions(request: Request, lei: str, period_code: str): raise RegTechHttpException( status_code=HTTPStatus.INTERNAL_SERVER_ERROR, name="Submission Delete Failed", - detail="Failed to delete submission data", + detail=f"Failed to delete submission data for LEI {lei}", ) from e try: repo.delete_user_actions(session, user_action_ids) @@ -128,7 +128,7 @@ def delete_submissions(request: Request, lei: str, period_code: str): raise RegTechHttpException( status_code=HTTPStatus.INTERNAL_SERVER_ERROR, name="User Action Delete Failed", - detail="Failed to delete user action data", + detail=f"Failed to delete user action data for LEI {lei}", ) from e delete_from_storage(period_code, lei) @@ -139,6 +139,6 @@ def delete_submissions(request: Request, lei: str, period_code: str): raise RegTechHttpException( status_code=HTTPStatus.NOT_ACCEPTABLE, name="Invalid LEI", - detail="Not a valid LEI", + detail=f"Not a valid LEI {lei}", ) return Response(status_code=status.HTTP_202_ACCEPTED) diff --git a/src/regtech_cleanup_api/routers/institution_cleanup.py b/src/regtech_cleanup_api/routers/institution_cleanup.py index c5d8a76..500f538 100644 --- a/src/regtech_cleanup_api/routers/institution_cleanup.py +++ b/src/regtech_cleanup_api/routers/institution_cleanup.py @@ -39,8 +39,8 @@ def delete_institution(request: Request, lei: str): if not is_valid_cleanup_lei(lei): raise RegTechHttpException( HTTPStatus.NOT_ACCEPTABLE, - name="Not Test LEI", - detail=f"{lei} not valid test lei.", + name="Invalid LEI", + detail=f"Not a valid LEI {lei}", ) else: return delete_helper(lei, request.state.db_session) @@ -59,8 +59,8 @@ def delete_helper(lei: str, session: Session): if not res: raise RegTechHttpException( HTTPStatus.NOT_FOUND, - name="Institution to be deleted Not Found", - detail=f"{lei} not found.", + name="Institution Delete Failed", + detail=f"Institution LEI {lei} not found.", ) else: try: @@ -68,8 +68,8 @@ def delete_helper(lei: str, session: Session): except Exception: raise RegTechHttpException( HTTPStatus.NOT_FOUND, - name="Group Not Found", - detail=f"The group to be deleted {lei} not found.", + name="Group Delete Failed", + detail=f"The group associated with LEI {lei} not found.", ) return Response(status_code=status.HTTP_204_NO_CONTENT) diff --git a/src/regtech_cleanup_api/services/cleanup_processor.py b/src/regtech_cleanup_api/services/cleanup_processor.py index c8884af..bac7e02 100644 --- a/src/regtech_cleanup_api/services/cleanup_processor.py +++ b/src/regtech_cleanup_api/services/cleanup_processor.py @@ -10,6 +10,6 @@ def delete_from_storage(period_code: str, lei: str) -> None: except Exception as e: raise RegTechHttpException( status_code=HTTPStatus.INTERNAL_SERVER_ERROR, - name="Delete Failure", + name="File Delete Failure", detail=f"Failed to delete file(s) for LEI {lei}", ) from e diff --git a/tests/services/test_cleanup_processor.py b/tests/services/test_cleanup_processor.py index 39a1d79..1b7579f 100644 --- a/tests/services/test_cleanup_processor.py +++ b/tests/services/test_cleanup_processor.py @@ -17,4 +17,4 @@ def test_delete_failure(mocker: MockerFixture): with pytest.raises(Exception) as e: cleanup_processor.delete_from_storage("test_period", "test") assert isinstance(e.value, RegTechHttpException) - assert e.value.name == "Delete Failure" + assert e.value.name == "File Delete Failure"