Handle (invalid) null hass objects.

This commit is contained in:
Dermot Duffy
2023-10-05 19:54:52 -07:00
parent c817601f60
commit ee8f9e3fd1
6 changed files with 107 additions and 17 deletions
+7 -1
View File
@@ -1,4 +1,4 @@
import { FrigateCardError, MESSAGE_TYPE_PRIORITIES, Message } from '../types';
import { FrigateCardError, MESSAGE_TYPE_PRIORITIES, Message, MessageType } from '../types';
import { errorToConsole } from '../utils/basic';
import { CardMessageAPI } from './types';
@@ -31,6 +31,12 @@ export class MessageManager {
}
}
public resetType(type: MessageType): void {
if (this._message?.type === type) {
this.reset();
}
}
public setErrorIfHigherPriority(error: unknown): void {
// This object should accept unknown objects to be able to seamlessly
// process arguments to catch() which can only be unknown/any.