Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty media stream config #698

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/isar/apis/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,14 @@ def _create_media_control_router(self) -> APIRouter:
methods=["GET"],
dependencies=[authentication_dependency],
summary="Generates a media stream connection config",
responses={
HTTPStatus.OK.value: {
"description": "Media stream was successfully generated",
},
HTTPStatus.NO_CONTENT.value: {
"description": "Robot has no media config",
},
},
)

return router
Expand Down
9 changes: 8 additions & 1 deletion src/isar/apis/robot_control/robot_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from isar.apis.models.models import RobotInfoResponse
from isar.config.settings import robot_settings, settings
from isar.services.utilities.robot_utilities import RobotUtilities
from fastapi import HTTPException


class RobotController:
Expand All @@ -17,7 +18,13 @@ def __init__(
self.logger = logging.getLogger("api")

def generate_media_config(self):
return self.robot_utilities.generate_media_config()
media_config = self.robot_utilities.generate_media_config()
if media_config is None:
raise HTTPException(
status_code=204,
detail="Robot has no media config",
)
return media_config

def get_info(self):
return RobotInfoResponse(
Expand Down
Loading