diff --git a/apps/challenges/views.py b/apps/challenges/views.py index cbfbd8834a..664375b7ca 100644 --- a/apps/challenges/views.py +++ b/apps/challenges/views.py @@ -2830,28 +2830,24 @@ def get_aws_credentials_for_participant_team(request, phase_pk): - When participant_team has not participanted in challenge - When Challenge is not Docker based """ - try: - challenge_phase = get_challenge_phase_model(phase_pk) - challenge = challenge_phase.challenge - participant_team = get_participant_team_of_user_for_a_challenge( - request.user, challenge.pk - ) - if not challenge.is_docker_based: - response_data = { - "error": "Sorry, this is not a docker based challenge." - } - return Response(response_data, status=status.HTTP_400_BAD_REQUEST) + challenge_phase = get_challenge_phase_model(phase_pk) + challenge = challenge_phase.challenge + participant_team = get_participant_team_of_user_for_a_challenge( + request.user, challenge.pk + ) + if not challenge.is_docker_based: + response_data = { + "error": "Sorry, this is not a docker based challenge." + } + return Response(response_data, status=status.HTTP_400_BAD_REQUEST) - if participant_team is None: - response_data = { - "error": "You have not participated in this challenge." - } - return Response(response_data, status=status.HTTP_400_BAD_REQUEST) - data = get_aws_credentials_for_submission(challenge, participant_team) - response_data = {"success": data} - except Exception as e: - response_data = {"error": e} + if participant_team is None: + response_data = { + "error": "You have not participated in this challenge." + } return Response(response_data, status=status.HTTP_400_BAD_REQUEST) + data = get_aws_credentials_for_submission(challenge, participant_team) + response_data = {"success": data} return Response(response_data, status=status.HTTP_200_OK)