@@ -425,7 +425,11 @@ def link_closed(self):
425
425
self .destination .links .remove (self )
426
426
427
427
if self .callbacks .link_closed != None :
428
- self .callbacks .link_closed (self )
428
+ try :
429
+ self .callbacks .link_closed (self )
430
+ except Exception as e :
431
+ RNS .log ("Error while executing link closed callback from " + str (self )+ ". The contained exception was: " + str (e ), RNS .LOG_ERROR )
432
+
429
433
430
434
def start_watchdog (self ):
431
435
thread = threading .Thread (target = self .__watchdog_job )
@@ -598,7 +602,10 @@ def receive(self, packet):
598
602
599
603
elif self .destination .proof_strategy == RNS .Destination .PROVE_APP :
600
604
if self .destination .callbacks .proof_requested :
601
- self .destination .callbacks .proof_requested (packet )
605
+ try :
606
+ self .destination .callbacks .proof_requested (packet )
607
+ except Exception as e :
608
+ RNS .log ("Error while executing proof request callback from " + str (self )+ ". The contained exception was: " + str (e ), RNS .LOG_ERROR )
602
609
603
610
elif packet .context == RNS .Packet .LINKIDENTIFY :
604
611
plaintext = self .decrypt (packet .data )
@@ -613,7 +620,10 @@ def receive(self, packet):
613
620
if identity .validate (signature , signed_data ):
614
621
self .__remote_identity = identity
615
622
if self .callbacks .remote_identified != None :
616
- self .callbacks .remote_identified (self .__remote_identity )
623
+ try :
624
+ self .callbacks .remote_identified (self .__remote_identity )
625
+ except Exception as e :
626
+ RNS .log ("Error while executing remote identified callback from " + str (self )+ ". The contained exception was: " + str (e ), RNS .LOG_ERROR )
617
627
618
628
elif packet .context == RNS .Packet .REQUEST :
619
629
try :
@@ -659,8 +669,11 @@ def receive(self, packet):
659
669
pass
660
670
elif self .resource_strategy == Link .ACCEPT_APP :
661
671
if self .callbacks .resource != None :
662
- if self .callbacks .resource (resource ):
663
- RNS .Resource .accept (packet , self .callbacks .resource_concluded )
672
+ try :
673
+ if self .callbacks .resource (resource ):
674
+ RNS .Resource .accept (packet , self .callbacks .resource_concluded )
675
+ except Exception as e :
676
+ RNS .log ("Error while executing resource accept callback from " + str (self )+ ". The contained exception was: " + str (e ), RNS .LOG_ERROR )
664
677
elif self .resource_strategy == Link .ACCEPT_ALL :
665
678
RNS .Resource .accept (packet , self .callbacks .resource_concluded )
666
679
@@ -933,7 +946,10 @@ def request_resource_concluded(self, resource):
933
946
self .link .pending_requests .remove (self )
934
947
935
948
if self .callbacks .failed != None :
936
- self .callbacks .failed (self )
949
+ try :
950
+ self .callbacks .failed (self )
951
+ except Exception as e :
952
+ RNS .log ("Error while executing request failed callback from " + str (self )+ ". The contained exception was: " + str (e ), RNS .LOG_ERROR )
937
953
938
954
939
955
def __response_timeout_job (self ):
@@ -951,7 +967,10 @@ def request_timed_out(self, packet_receipt):
951
967
self .link .pending_requests .remove (self )
952
968
953
969
if self .callbacks .failed != None :
954
- self .callbacks .failed (self )
970
+ try :
971
+ self .callbacks .failed (self )
972
+ except Exception as e :
973
+ RNS .log ("Error while executing request timed out callback from " + str (self )+ ". The contained exception was: " + str (e ), RNS .LOG_ERROR )
955
974
956
975
957
976
def response_resource_progress (self , resource ):
@@ -967,7 +986,10 @@ def response_resource_progress(self, resource):
967
986
self .progress = resource .get_progress ()
968
987
969
988
if self .callbacks .progress != None :
970
- self .callbacks .progress (self )
989
+ try :
990
+ self .callbacks .progress (self )
991
+ except Exception as e :
992
+ RNS .log ("Error while executing response progress callback from " + str (self )+ ". The contained exception was: " + str (e ), RNS .LOG_ERROR )
971
993
else :
972
994
resource .cancel ()
973
995
@@ -987,10 +1009,16 @@ def response_received(self, response):
987
1009
self .packet_receipt .callbacks .delivery (self .packet_receipt )
988
1010
989
1011
if self .callbacks .progress != None :
990
- self .callbacks .progress (self )
1012
+ try :
1013
+ self .callbacks .progress (self )
1014
+ except Exception as e :
1015
+ RNS .log ("Error while executing response progress callback from " + str (self )+ ". The contained exception was: " + str (e ), RNS .LOG_ERROR )
991
1016
992
1017
if self .callbacks .response != None :
993
- self .callbacks .response (self )
1018
+ try :
1019
+ self .callbacks .response (self )
1020
+ except Exception as e :
1021
+ RNS .log ("Error while executing response received callback from " + str (self )+ ". The contained exception was: " + str (e ), RNS .LOG_ERROR )
994
1022
995
1023
def get_request_id (self ):
996
1024
"""
0 commit comments