Skip to content
Snippets Groups Projects
Commit 32f96987 authored by Martina Müller's avatar Martina Müller
Browse files

refactor: add error handling for unknown channel type, #146

parent cb4e7164
No related branches found
No related tags found
1 merge request!47Refactor: add error handling for unknown channel type
Pipeline #8544 passed
...@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- added error handling if no matching channel type is found
- ... - ...
### Changed ### Changed
......
...@@ -601,6 +601,8 @@ class ChannelFactory: ...@@ -601,6 +601,8 @@ class ChannelFactory:
Returns: Returns:
(GenericChannel): A concrete implementation of the generic channel (GenericChannel): A concrete implementation of the generic channel
Raises:
ValueError: If no matching channel type is found
""" """
if channel_name in ChannelType.QUEUE.channels: if channel_name in ChannelType.QUEUE.channels:
self.logger.debug(f"Create new QUEUE channel '{channel_name}'") self.logger.debug(f"Create new QUEUE channel '{channel_name}'")
...@@ -611,8 +613,11 @@ class ChannelFactory: ...@@ -611,8 +613,11 @@ class ChannelFactory:
if channel_name in ChannelType.LIVE.channels: if channel_name in ChannelType.LIVE.channels:
self.logger.debug(f"Create new LINE channel '{channel_name}'") self.logger.debug(f"Create new LINE channel '{channel_name}'")
return LineChannel(channel_index, channel_name, mixer) return LineChannel(channel_index, channel_name, mixer)
# FIXME: Error handling when no ChannelType was found error_message = (
self.logger.error("No ChannelType found! Now stuff is not working as intended") f"No valid ChannelType found for channel '{channel_name}'. Not working as intended."
)
self.logger.error(error_message)
raise ValueError(error_message)
class PlayoutStatusResponse(StrEnum): class PlayoutStatusResponse(StrEnum):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment