Use HTTP_INTERNAL_SERVER_ERROR constant (#33832)

This commit is contained in:
springstan 2020-04-08 23:20:03 +02:00 committed by GitHub
parent 15ab63a4c2
commit fb8f8133a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 122 additions and 69 deletions

View file

@ -19,7 +19,7 @@ from homeassistant.components.google_assistant import helpers as google_helpers
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.http.data_validator import RequestDataValidator
from homeassistant.components.websocket_api import const as ws_const
from homeassistant.const import HTTP_OK
from homeassistant.const import HTTP_INTERNAL_SERVER_ERROR, HTTP_OK
from homeassistant.core import callback
from .const import (
@ -64,11 +64,11 @@ SCHEMA_WS_HOOK_DELETE = websocket_api.BASE_COMMAND_MESSAGE_SCHEMA.extend(
_CLOUD_ERRORS = {
InvalidTrustedNetworks: (
500,
HTTP_INTERNAL_SERVER_ERROR,
"Remote UI not compatible with 127.0.0.1/::1 as a trusted network.",
),
InvalidTrustedProxies: (
500,
HTTP_INTERNAL_SERVER_ERROR,
"Remote UI not compatible with 127.0.0.1/::1 as trusted proxies.",
),
}
@ -115,7 +115,10 @@ async def async_setup(hass):
auth.Unauthenticated: (401, "Authentication failed."),
auth.PasswordChangeRequired: (400, "Password change required."),
asyncio.TimeoutError: (502, "Unable to reach the Home Assistant cloud."),
aiohttp.ClientError: (500, "Error making internal request"),
aiohttp.ClientError: (
HTTP_INTERNAL_SERVER_ERROR,
"Error making internal request",
),
}
)