Commits

Ginés Martínez Sánchez committed f767c0d Draft

protect against exceptions

  • Participants
  • Parent commits 9813ddd

Comments (0)

Files changed (2)

File ginsfsm/c_sock.py

         close_all_sockets(obj._socket_map)
         raise
     except:
-        #obj.handle_error() #TODO
-        raise
+        logging.error("Exception in I/O handler for fd %r", obj, exc_info=True)
 
 
 def poll_loop(socket_map, _impl, timeout):

File ginsfsm/gaplic.py

             else:
                 it += 1
                 #TODO consider names of another gaplics
-                destination = self._resolv_destination(event.destination)
-                cur_ident = threading.current_thread().ident
-                if cur_ident != self._thread_ident:
-                    logging.error("????????????????????????????????????")
+                try:
+                    destination = self._resolv_destination(event.destination)
+                    cur_ident = threading.current_thread().ident
+                    if cur_ident != self._thread_ident:
+                        logging.error("??????????????????")
 
-                dst_ident = destination.gaplic._thread_ident
-                if cur_ident == dst_ident:
-                    self.send_event(destination, event.event_name, **event.kw)
-                else:
-                    # Yeah, send to another gaplic
-                    gaplic = get_gaplic_by_thread_ident(dst_ident)
-                    if gaplic:
-                        gaplic.enqueue_event(event)
+                    dst_ident = destination.gaplic._thread_ident
+                    if cur_ident == dst_ident:
+                        self.send_event(
+                            destination,
+                            event.event_name,
+                            **event.kw)
+                    else:
+                        # Yeah, send to another gaplic
+                        gaplic = get_gaplic_by_thread_ident(dst_ident)
+                        if gaplic:
+                            gaplic.enqueue_event(event)
+                except Exception:
+                    logging.error("Exception gaplic.__process_qevent",
+                                  exc_info=True)
+
         return False
 
     def _process_timer(self):