Skip to content

Commit 211d19b

Browse files
committed
Specific error class
1 parent 4957efe commit 211d19b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/recceiver/cfstore.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,14 @@ def create_new_channel(
10441044
_log.debug("Add new alias: %s from %s", alias, channel_name)
10451045

10461046

1047+
class IOCMissingInfoError(Exception):
1048+
"""Raised when an IOC is missing required information."""
1049+
1050+
def __init__(self, ioc_info: IocInfo):
1051+
super().__init__(f"Missing hostName {ioc_info.hostname} or iocName {ioc_info.ioc_name}")
1052+
self.ioc_info = ioc_info
1053+
1054+
10471055
def _update_channelfinder(
10481056
processor: CFProcessor, record_info_by_name: Dict[str, RecordInfo], records_to_delete, ioc_info: IocInfo
10491057
) -> None:
@@ -1072,7 +1080,7 @@ def _update_channelfinder(
10721080
_log.warning("IOC Env Info %s not found in ioc list: %s", ioc_info, iocs)
10731081

10741082
if ioc_info.hostname is None or ioc_info.ioc_name is None:
1075-
raise Exception(f"Missing hostName {ioc_info.hostname} or iocName {ioc_info.ioc_name}")
1083+
raise IOCMissingInfoError(ioc_info)
10761084

10771085
if processor.cancelled:
10781086
raise defer.CancelledError(f"Processor cancelled in _update_channelfinder for {ioc_info}")

0 commit comments

Comments
 (0)