Fix error handling for expired html5 registration (#67676)

This commit is contained in:
Eric Severance 2022-03-30 04:30:08 -07:00 committed by GitHub
parent 9f0665bbb4
commit 3953b6abe2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 1 deletions

View file

@ -533,7 +533,9 @@ class HTML5NotificationService(BaseNotificationService):
if response.status_code == 410:
_LOGGER.info("Notification channel has expired")
reg = self.registrations.pop(target)
if not save_json(self.registrations_json_path, self.registrations):
try:
save_json(self.registrations_json_path, self.registrations)
except HomeAssistantError:
self.registrations[target] = reg
_LOGGER.error("Error saving registration")
else: