fix(music-render): handle AttributeError on dispatch typo (T8 follow-up)

Code review found: getattr(sys.modules[__name__], fn_name) raises
AttributeError if a dispatch table string entry is a typo. Now caught
and reported via webhook_update_task as 'internal dispatch error'.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-19 05:03:48 +09:00
parent 9127616669
commit 44bc065796

View File

@@ -58,7 +58,12 @@ def _dispatch(payload: dict) -> None:
logger.error("unknown job_type=%s task=%s", job_type, task_id) logger.error("unknown job_type=%s task=%s", job_type, task_id)
webhook_update_task(task_id, "failed", 0, "", error=f"unknown job_type: {job_type}") webhook_update_task(task_id, "failed", 0, "", error=f"unknown job_type: {job_type}")
return return
fn = getattr(_self, fn_name) try:
fn = getattr(_self, fn_name)
except AttributeError:
logger.error("dispatch table typo for job_type=%s name=%s task=%s", job_type, fn_name, task_id)
webhook_update_task(task_id, "failed", 0, "", error=f"internal dispatch error: {fn_name}")
return
fn(task_id, params) fn(task_id, params)