Use status 404 in more places when appropriate (#5480)

This commit is contained in:
Mike Degatano
2024-12-17 05:18:32 -05:00
committed by GitHub
parent de68868788
commit d8101ddba8
18 changed files with 374 additions and 139 deletions

View File

@@ -16,7 +16,7 @@ from ..const import (
AddonState,
)
from ..coresys import CoreSysAttributes
from ..exceptions import APIError, APIForbidden
from ..exceptions import APIForbidden, APINotFound
from .utils import api_process, api_validate, require_home_assistant
_LOGGER: logging.Logger = logging.getLogger(__name__)
@@ -36,7 +36,7 @@ class APIDiscovery(CoreSysAttributes):
"""Extract discovery message from URL."""
message = self.sys_discovery.get(request.match_info.get("uuid"))
if not message:
raise APIError("Discovery message not found")
raise APINotFound("Discovery message not found")
return message
@api_process