diff options
Diffstat (limited to 'include/py/homekit/http')
-rw-r--r-- | include/py/homekit/http/http.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/py/homekit/http/http.py b/include/py/homekit/http/http.py index b1d33d3..867fca7 100644 --- a/include/py/homekit/http/http.py +++ b/include/py/homekit/http/http.py @@ -4,7 +4,7 @@ import html from enum import Enum from aiohttp import web -from aiohttp.web import HTTPFound +from aiohttp.web import HTTPFound, HTTPMovedPermanently, HTTPException from aiohttp.web_exceptions import HTTPNotFound from ..util import stringify, format_tb, Addr from ..config import is_development_mode @@ -55,9 +55,17 @@ async def errors_handler_middleware(request, handler): code=404 ) - except HTTPFound as exc: + except (HTTPFound, HTTPMovedPermanently) as exc: raise exc + except HTTPException as exc: + _logger.exception(exc) + return _render_error( + error_type=exc.reason, + error_message=exc.text, + traceback=format_tb(exc) + ) + except Exception as exc: _logger.exception(exc) return _render_error( |