mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-05 14:31:21 +00:00
Add error handling logic to MessageStorage
This commit is contained in:
parent
bad7297c94
commit
1a52ed2c9a
@ -2,6 +2,7 @@
|
|||||||
# All Rights Reserved. See LICENSE file for details.
|
# All Rights Reserved. See LICENSE file for details.
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
from contextlib import suppress
|
||||||
|
|
||||||
from tornado.web import Application
|
from tornado.web import Application
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ class MessageStorage(ABC):
|
|||||||
self.saved_messages = []
|
self.saved_messages = []
|
||||||
|
|
||||||
def save_message(self, message):
|
def save_message(self, message):
|
||||||
|
with suppress(KeyError, AttributeError):
|
||||||
if self.filter_message(message):
|
if self.filter_message(message):
|
||||||
self.saved_messages.extend(self.transform_message(message))
|
self.saved_messages.extend(self.transform_message(message))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user