mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-04-02 00:07:16 +01:00
Remove CLI command hint from unknown error messages (#6684)
* Remove CLI command hint from unknown error messages Since #6303 introduced specific error messages for many cases, the generic "check with 'ha supervisor logs'" hint in unknown error messages is no longer as useful. Remove the CLI command part while keeping the "Check supervisor logs for details" rider. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Use consistently "Supervisor logs" with capitalization Co-authored-by: Jan Čermák <sairon@users.noreply.github.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Jan Čermák <sairon@users.noreply.github.com>
This commit is contained in:
@@ -148,7 +148,7 @@ def api_return_error(
|
||||
if check_exception_chain(error, DockerAPIError):
|
||||
message = format_message(message)
|
||||
if not message:
|
||||
message = "Unknown error, see Supervisor logs (check with 'ha supervisor logs')"
|
||||
message = "Unknown error, see Supervisor logs"
|
||||
|
||||
match error_type:
|
||||
case const.CONTENT_TYPE_TEXT:
|
||||
|
||||
@@ -5,11 +5,6 @@ from typing import Any
|
||||
|
||||
from .const import OBSERVER_PORT
|
||||
|
||||
MESSAGE_CHECK_SUPERVISOR_LOGS = (
|
||||
"Check supervisor logs for details (check with '{logs_command}')"
|
||||
)
|
||||
EXTRA_FIELDS_LOGS_COMMAND = {"logs_command": "ha supervisor logs"}
|
||||
|
||||
|
||||
class HassioError(Exception):
|
||||
"""Root exception."""
|
||||
@@ -125,9 +120,8 @@ class APIUnknownSupervisorError(APIError):
|
||||
) -> None:
|
||||
"""Initialize exception."""
|
||||
self.message_template = (
|
||||
f"{self.message_template}. {MESSAGE_CHECK_SUPERVISOR_LOGS}"
|
||||
f"{self.message_template}. Check Supervisor logs for details"
|
||||
)
|
||||
self.extra_fields = (self.extra_fields or {}) | EXTRA_FIELDS_LOGS_COMMAND
|
||||
super().__init__(None, logger, job_id=job_id)
|
||||
|
||||
|
||||
|
||||
@@ -98,9 +98,7 @@ class SupervisorJobError:
|
||||
"""Representation of an error occurring during a supervisor job."""
|
||||
|
||||
type_: type[HassioError] = HassioError
|
||||
message: str = (
|
||||
"Unknown error, see Supervisor logs (check with 'ha supervisor logs')"
|
||||
)
|
||||
message: str = "Unknown error, see Supervisor logs"
|
||||
stage: str | None = None
|
||||
error_key: str | None = None
|
||||
extra_fields: dict[str, Any] | None = None
|
||||
|
||||
@@ -599,12 +599,11 @@ async def test_addon_start_options_error(
|
||||
body = await resp.json()
|
||||
assert (
|
||||
body["message"]
|
||||
== "An unknown error occurred with addon local_example. Check supervisor logs for details (check with 'ha supervisor logs')"
|
||||
== "An unknown error occurred with addon local_example. Check Supervisor logs for details"
|
||||
)
|
||||
assert body["error_key"] == "addon_unknown_error"
|
||||
assert body["extra_fields"] == {
|
||||
"addon": "local_example",
|
||||
"logs_command": "ha supervisor logs",
|
||||
}
|
||||
assert "Add-on local_example can't write options" in caplog.text
|
||||
|
||||
@@ -682,10 +681,9 @@ async def test_addon_rebuild_fails_error(api_client: TestClient, coresys: CoreSy
|
||||
body = await resp.json()
|
||||
assert (
|
||||
body["message"]
|
||||
== "An unknown error occurred while trying to build the image for addon local_ssh. Check supervisor logs for details (check with 'ha supervisor logs')"
|
||||
== "An unknown error occurred while trying to build the image for addon local_ssh. Check Supervisor logs for details"
|
||||
)
|
||||
assert body["error_key"] == "addon_build_failed_unknown_error"
|
||||
assert body["extra_fields"] == {
|
||||
"addon": "local_ssh",
|
||||
"logs_command": "ha supervisor logs",
|
||||
}
|
||||
|
||||
@@ -182,9 +182,8 @@ async def test_list_users_ws_error(
|
||||
result = await resp.json()
|
||||
assert result == {
|
||||
"result": "error",
|
||||
"message": "Can't request listing users on Home Assistant. Check supervisor logs for details (check with 'ha supervisor logs')",
|
||||
"message": "Can't request listing users on Home Assistant. Check Supervisor logs for details",
|
||||
"error_key": "auth_list_users_error",
|
||||
"extra_fields": {"logs_command": "ha supervisor logs"},
|
||||
}
|
||||
assert "Can't request listing users on Home Assistant: fail" in caplog.text
|
||||
|
||||
@@ -374,7 +373,7 @@ async def test_auth_backend_login_failure(api_client: TestClient):
|
||||
body = await resp.json()
|
||||
assert (
|
||||
body["message"]
|
||||
== "Unable to validate authentication details with Home Assistant. Check supervisor logs for details (check with 'ha supervisor logs')"
|
||||
== "Unable to validate authentication details with Home Assistant. Check Supervisor logs for details"
|
||||
)
|
||||
assert body["error_key"] == "auth_home_assistant_api_validation_error"
|
||||
assert body["extra_fields"] == {"logs_command": "ha supervisor logs"}
|
||||
assert "extra_fields" not in body
|
||||
|
||||
@@ -195,11 +195,10 @@ async def test_api_store_repair_repository_git_error(
|
||||
assert result["error_key"] == "store_repository_unknown_error"
|
||||
assert result["extra_fields"] == {
|
||||
"repo": test_repository.slug,
|
||||
"logs_command": "ha supervisor logs",
|
||||
}
|
||||
assert (
|
||||
result["message"]
|
||||
== f"An unknown error occurred with addon repository {test_repository.slug}. Check supervisor logs for details (check with 'ha supervisor logs')"
|
||||
== f"An unknown error occurred with addon repository {test_repository.slug}. Check Supervisor logs for details"
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -443,10 +443,10 @@ async def test_supervisor_api_stats_failure(
|
||||
body = await resp.json()
|
||||
assert (
|
||||
body["message"]
|
||||
== "An unknown error occurred with Supervisor. Check supervisor logs for details (check with 'ha supervisor logs')"
|
||||
== "An unknown error occurred with Supervisor. Check Supervisor logs for details"
|
||||
)
|
||||
assert body["error_key"] == "supervisor_unknown_error"
|
||||
assert body["extra_fields"] == {"logs_command": "ha supervisor logs"}
|
||||
assert "extra_fields" not in body
|
||||
assert (
|
||||
"Could not inspect container 'hassio_supervisor': [500] {'message': 'fail'}"
|
||||
in caplog.text
|
||||
|
||||
@@ -198,7 +198,7 @@ async def test_notify_on_change(coresys: CoreSys, ha_ws_client: AsyncMock):
|
||||
"errors": [
|
||||
{
|
||||
"type": "HassioError",
|
||||
"message": "Unknown error, see Supervisor logs (check with 'ha supervisor logs')",
|
||||
"message": "Unknown error, see Supervisor logs",
|
||||
"stage": "test",
|
||||
"error_key": None,
|
||||
"extra_fields": None,
|
||||
@@ -228,7 +228,7 @@ async def test_notify_on_change(coresys: CoreSys, ha_ws_client: AsyncMock):
|
||||
"errors": [
|
||||
{
|
||||
"type": "HassioError",
|
||||
"message": "Unknown error, see Supervisor logs (check with 'ha supervisor logs')",
|
||||
"message": "Unknown error, see Supervisor logs",
|
||||
"stage": "test",
|
||||
"error_key": None,
|
||||
"extra_fields": None,
|
||||
|
||||
Reference in New Issue
Block a user