Skip to content

Commit 475013f

Browse files
committed
Introduce APIGone exception for removed APIs
Introduce a new exception class APIGone to indicate that certain API features have been removed and are no longer available. Update the security integrity check endpoint to raise this new exception instead of a generic APIError, providing clearer communication to clients that the feature has been intentionally removed.
1 parent 8256319 commit 475013f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

supervisor/api/security.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from aiohttp import web
66
import voluptuous as vol
77

8+
from supervisor.exceptions import APIGone
9+
810
from ..const import ATTR_CONTENT_TRUST, ATTR_FORCE_SECURITY, ATTR_PWNED
911
from ..coresys import CoreSysAttributes
1012
from .utils import api_process, api_validate
@@ -52,6 +54,6 @@ async def integrity_check(self, request: web.Request) -> dict[str, Any]:
5254
"""Run backend integrity check.
5355
5456
CodeNotary integrity checking has been removed. This endpoint now returns
55-
an error indicating the feature is currently non-functional.
57+
an error indicating the feature is gone.
5658
"""
57-
return {"error": "No integrity checking available"}
59+
raise APIGone("Integrity check feature has been removed.")

supervisor/exceptions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@ class APINotFound(APIError):
423423
status = 404
424424

425425

426+
class APIGone(APIError):
427+
"""API is no longer available."""
428+
429+
status = 410
430+
431+
426432
class APIAddonNotInstalled(APIError):
427433
"""Not installed addon requested at addons API."""
428434

0 commit comments

Comments
 (0)