@@ -314,28 +314,35 @@ def _monotonic(self) -> float:
314314 return self ._aioloop .time ()
315315
316316 async def _initialize (self ) -> None :
317- self ._loop = IOLoop .current ()
318- for (func , args ) in self .cached_events :
319- func (* args )
320- self .cached_events = []
321- self .update_timer .start (delay = 60. )
322- self .cpu_timer .start ()
323- self .ping_timer .start ()
324- if self .printer .is_operational ():
325- self ._on_printer_connected ()
326- else :
327- self ._update_state_from_octo ()
328- self .cache .machine_data = await self ._get_machine_data ()
329- await self .webcam_stream .test_connection ()
330- await self ._connect ()
317+ try :
318+ self ._loop = IOLoop .current ()
319+ for (func , args ) in self .cached_events :
320+ func (* args )
321+ self .cached_events = []
322+ self .update_timer .start (delay = 60. )
323+ self .cpu_timer .start ()
324+ self .ping_timer .start ()
325+ if self .printer .is_operational ():
326+ self ._on_printer_connected ()
327+ else :
328+ self ._update_state_from_octo ()
329+ self .cache .machine_data = await self ._get_machine_data ()
330+ await self .webcam_stream .test_connection ()
331+ await self ._connect ()
332+ except Exception as e :
333+ self ._logger .error ("Failed to initialize SimplyPrint Plugin!" , exc_info = e )
331334
332335 async def _get_machine_data (self ) -> Dict [str , Any ]:
333- sys_query = SystemQuery (self .settings )
334- data = await self ._loop .run_in_executor (None , sys_query .get_system_info )
335- data ["ui" ] = "OctoPrint"
336- data ["api" ] = "OctoPrint"
337- data ["sp_version" ] = self .plugin ._plugin_version
338- return data
336+ try :
337+ sys_query = SystemQuery (self .settings )
338+ data = await self ._loop .run_in_executor (None , sys_query .get_system_info )
339+ data ["ui" ] = "OctoPrint"
340+ data ["api" ] = "OctoPrint"
341+ data ["sp_version" ] = self .plugin ._plugin_version
342+ return data
343+ except Exception as e :
344+ self ._logger .warning ("Failed to get machine data" , exc_info = e )
345+ return {}
339346
340347 async def _connect (self ) -> None :
341348 log_connect = True
0 commit comments