fix: Substantially reduce cases where errors block whole card (#1764)
This commit is contained in:
+2
-11
@@ -1,12 +1,9 @@
|
||||
import { CameraEndpoint } from '../camera-manager/types';
|
||||
import { dispatchErrorMessageEvent } from '../components/message';
|
||||
import { localize } from '../localize/localize';
|
||||
import { ExtendedHomeAssistant } from '../types';
|
||||
import { errorToConsole } from './basic';
|
||||
import { homeAssistantSignPath } from './ha';
|
||||
|
||||
export const getEndpointAddressOrDispatchError = async (
|
||||
element: HTMLElement,
|
||||
export const convertEndpointAddressToSignedWebsocket = async (
|
||||
hass: ExtendedHomeAssistant,
|
||||
endpoint: CameraEndpoint,
|
||||
expires?: number,
|
||||
@@ -20,13 +17,7 @@ export const getEndpointAddressOrDispatchError = async (
|
||||
response = await homeAssistantSignPath(hass, endpoint.endpoint, expires);
|
||||
} catch (e) {
|
||||
errorToConsole(e as Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!response) {
|
||||
dispatchErrorMessageEvent(element, localize('error.failed_sign'));
|
||||
return null;
|
||||
}
|
||||
|
||||
return response.replace(/^http/i, 'ws');
|
||||
return response ? response.replace(/^http/i, 'ws') : null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user