Skip to content

Commit 26d6654

Browse files
committed
Specific error class
1 parent 225e48c commit 26d6654

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
@@ -1042,6 +1042,14 @@ def create_new_channel(
10421042
_log.debug("Add new alias: %s from %s", alias, channel_name)
10431043

10441044

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

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

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

0 commit comments

Comments
 (0)