Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions supervisor/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import asyncio
from collections.abc import Callable, Mapping
import json
import logging
from typing import Any, cast

from aiohttp import web
Expand Down Expand Up @@ -31,8 +32,11 @@
from ..utils import check_exception_chain, get_message_from_exception_chain
from ..utils.json import json_dumps, json_loads as json_loads_util
from ..utils.log_format import format_message
from ..utils.sentry import async_capture_exception
from . import const

_LOGGER: logging.Logger = logging.getLogger(__name__)


def extract_supervisor_token(request: web.Request) -> str | None:
"""Extract Supervisor token from request."""
Expand Down Expand Up @@ -72,6 +76,8 @@ async def wrap_api(*args, **kwargs) -> web.Response | web.StreamResponse:
err, status=err.status, job_id=err.job_id, headers=err.headers
)
except HassioError as err:
_LOGGER.exception("Unexpected error during API call: %s", err)
await async_capture_exception(err)
return api_return_error(err)

if isinstance(answer, (dict, list)):
Expand Down Expand Up @@ -119,6 +125,8 @@ async def wrap_api(*args, **kwargs) -> web.Response | web.StreamResponse:
job_id=err.job_id,
)
except HassioError as err:
_LOGGER.exception("Unexpected error during API call: %s", err)
await async_capture_exception(err)
return api_return_error(
err, error_type=error_type or const.CONTENT_TYPE_BINARY
)
Expand Down
2 changes: 0 additions & 2 deletions supervisor/os/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
)
from ..jobs.const import JobConcurrency, JobCondition
from ..jobs.decorator import Job
from ..utils.sentry import async_capture_exception
from .data_disk import DataDisk

_LOGGER: logging.Logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -363,7 +362,6 @@ async def set_boot_slot(self, boot_name: str) -> None:
RaucState.ACTIVE, self.get_slot_name(boot_name)
)
except DBusError as err:
await async_capture_exception(err)
raise HassOSSlotUpdateError(
f"Can't mark {boot_name} as active!", _LOGGER.error
) from err
Expand Down