File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -112,8 +112,11 @@ async def _ensure_init_community_feed(self):
112112 await self ._community_feed .start ()
113113
114114 async def register_feed_callback (self , channel_type , callback , identifier = None ):
115- await self ._ensure_init_community_feed ()
116- await self ._community_feed .register_feed_callback (channel_type , callback , identifier = identifier )
115+ try :
116+ await self ._ensure_init_community_feed ()
117+ await self ._community_feed .register_feed_callback (channel_type , callback , identifier = identifier )
118+ except errors .DeviceError as e :
119+ self .logger .error (f"Impossible to connect to community signals: { e } " )
117120
118121 async def send (self , message , channel_type , identifier = None ):
119122 """
@@ -230,7 +233,7 @@ async def update_selected_device(self):
230233 self .user_account .flush_device_details ()
231234 await self ._load_device_if_selected ()
232235 if not self .user_account .has_selected_device_data ():
233- self .logger .info ("No selected device. Please select a device to enable your community features." )
236+ self .logger .info (self . user_account . NO_SELECTED_DEVICE_DESC )
234237
235238 async def _load_device_if_selected (self ):
236239 # 1. use user selected device id if any
Original file line number Diff line number Diff line change 1414# You should have received a copy of the GNU General Public
1515# License along with OctoBot. If not, see <https://www.gnu.org/licenses/>.
1616import octobot .community .community_supports as community_supports
17+ import octobot .community .errors as errors
1718
1819
1920class CommunityUserAccount :
2021 USER_DATA_CONTENT = "content"
22+ NO_SELECTED_DEVICE_DESC = "No selected device. Please select a device to enable your community features."
23+
2124
2225 def __init__ (self ):
2326 self .gql_user_id = None
@@ -51,7 +54,10 @@ def get_selected_device_raw_data(self):
5154 return self ._selected_device_raw_data
5255
5356 def get_selected_device_uuid (self ):
54- return self .get_selected_device_raw_data ().get ("uuid" , None )
57+ try :
58+ return self .get_selected_device_raw_data ().get ("uuid" , None )
59+ except AttributeError :
60+ raise errors .DeviceError (self .NO_SELECTED_DEVICE_DESC )
5561
5662 @staticmethod
5763 def get_device_id (device ):
You can’t perform that action at this time.
0 commit comments