[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit 9ed1fbb9426ceb707a13c6d7a5093ec6a02660fc
Author: juga0 
Date:   Wed Jul 4 08:54:31 2018 +

Replace Exception by the possible exceptions
---
 sbws/util/stem.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index e09f23c..b62de82 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -40,7 +40,7 @@ def attach_stream_to_circuit_listener(controller, circ_id):
 def add_event_listener(controller, func, event):
 try:
 controller.add_event_listener(func, event)
-except Exception as e:
+except ProtocolError as e:
 log.exception("Exception trying to add event listener %s", e)
 
 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit 0bb09a896bb4fc7a2535cf08833388ea1444e3bb
Author: juga0 
Date:   Wed Jul 4 08:58:59 2018 +

Replace Exception by the possible exceptions
---
 sbws/util/stem.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index 85fd7e6..32c9b8c 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -245,7 +245,7 @@ def circuit_str(controller, circ_id):
 log.warning('Circuit %s no longer seems to exist so can\'t return '
 'a valid circuit string for it: %s', circ_id, e)
 return None
-except Exception as e:
+except ControllerError as e:
 log.exception("Exception trying to get circuit string %s", e)
 return None
 return '[' +\



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit c20f90acd6c7a10888b3dc4d48045d436ad957d8
Author: juga0 
Date:   Wed Jul 4 08:52:55 2018 +

Replace Exception by the possible exceptions
---
 sbws/lib/relaylist.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index f674b62..f177a96 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -198,7 +198,7 @@ class RelayList:
 try:
 relays = [Relay(ns.fingerprint, c, ns=ns)
   for ns in c.get_network_statuses()]
-except Exception as e:
+except ControllerError as e:
 log.exception("Exception trying to init relays %s", e)
 return []
 return relays



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit af869ad0701064600c9f1d161c8cb6300bb023f3
Author: juga0 
Date:   Wed Jul 4 08:50:29 2018 +

Replace Exception by the possible exceptions
---
 sbws/lib/circuitbuilder.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbws/lib/circuitbuilder.py b/sbws/lib/circuitbuilder.py
index c2c9b97..8791656 100644
--- a/sbws/lib/circuitbuilder.py
+++ b/sbws/lib/circuitbuilder.py
@@ -97,7 +97,7 @@ class CircuitBuilder:
 c.close_circuit(circ_id)
 except InvalidArguments:
 pass
-except Exception as e:
+except (ControllerError, InvalidArguments) as e:
 log.exception("Exception trying to get circuit to delete: %s",
   e)
 self.built_circuits.clear()



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit 218da1c5243c4c9d95eb91f44be15a155b56e848
Author: juga0 
Date:   Wed Jul 4 08:26:14 2018 +

Replace Exception by the possible exceptions
---
 sbws/util/stem.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index b4190ef..e09f23c 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -195,7 +195,7 @@ def launch_tor(conf):
 try:
 cont.set_conf('__DisablePredictedCircuits', '1')
 cont.set_conf('__LeaveStreamsUnattached', '1')
-except Exception as e:
+except (ControllerError, InvalidArguments, InvalidRequest) as e:
 log.exception("Error trying to launch tor: %s. "
   "Maybe the tor directory is being used by other "
   "sbws instance?", e)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit 3036638b9ebe69bd36ab312b9eb5b275a39d89a8
Author: juga0 
Date:   Wed Jul 4 08:32:05 2018 +

Replace Exception by the possible exceptions
---
 sbws/lib/circuitbuilder.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sbws/lib/circuitbuilder.py b/sbws/lib/circuitbuilder.py
index f143b6a..faa73cf 100644
--- a/sbws/lib/circuitbuilder.py
+++ b/sbws/lib/circuitbuilder.py
@@ -1,5 +1,5 @@
 from stem import CircuitExtensionFailed, InvalidRequest, ProtocolError, Timeout
-from stem import InvalidArguments
+from stem import InvalidArguments, ControllerError
 import random
 from .relaylist import Relay
 import logging
@@ -64,7 +64,7 @@ class CircuitBuilder:
 except InvalidArguments:
 pass
 self.built_circuits.discard(circ_id)
-except Exception as e:
+except (ControllerError, ValueError) as e:
 log.exception("Error trying to get circuit to close it: %s.", e)
 
 def _build_circuit_impl(self, path):



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit d1aebaf48960fe7e85299213ff49fc02b71521ae
Author: juga0 
Date:   Wed Jul 4 08:54:53 2018 +

Replace Exception by the possible exceptions
---
 sbws/util/stem.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index b62de82..bbd4e7a 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -47,7 +47,7 @@ def add_event_listener(controller, func, event):
 def remove_event_listener(controller, func):
 try:
 controller.remove_event_listener(func)
-except Exception as e:
+except ProtocolError as e:
 log.exception("Exception trying to remove event %s", e)
 
 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit 4776f2e3c1d2929ce61110c6a6d10d73c827c6fa
Author: juga0 
Date:   Wed Jul 4 08:42:22 2018 +

Replace Exception by the possible exceptions
---
 sbws/lib/circuitbuilder.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbws/lib/circuitbuilder.py b/sbws/lib/circuitbuilder.py
index faa73cf..caca3eb 100644
--- a/sbws/lib/circuitbuilder.py
+++ b/sbws/lib/circuitbuilder.py
@@ -61,7 +61,7 @@ class CircuitBuilder:
 c.get_circuit(circ_id, default=None)
 try:
 c.close_circuit(circ_id)
-except InvalidArguments:
+except (InvalidArguments, InvalidRequest):
 pass
 self.built_circuits.discard(circ_id)
 except (ControllerError, ValueError) as e:



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit 026330bcfc2b7ab256d7aeef6bf249a05d9f113c
Author: juga0 
Date:   Wed Jul 4 08:57:48 2018 +

Replace Exception by the possible exceptions
---
 sbws/util/stem.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index bbd4e7a..85fd7e6 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -211,7 +211,7 @@ def get_socks_info(controller):
 try:
 socks_ports = controller.get_listeners(Listener.SOCKS)
 return socks_ports[0]
-except Exception as e:
+except ControllerError as e:
 log.exception("Exception trying to get socks info: %e.", e)
 exit(1)
 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit e7c51a10daf6ab718e25075814b68bee975e2704
Author: juga0 
Date:   Wed Jul 4 08:15:58 2018 +

Replace Exception by the possible exceptions
---
 sbws/util/stem.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sbws/util/stem.py b/sbws/util/stem.py
index c4497b1..0c36d61 100644
--- a/sbws/util/stem.py
+++ b/sbws/util/stem.py
@@ -1,6 +1,7 @@
 from stem.control import (Controller, Listener)
 from stem import (SocketError, InvalidRequest, UnsatisfiableRequest,
-  OperationFailed)
+  OperationFailed, ControllerError, InvalidArguments,
+  ProtocolError)
 from stem.connection import IncorrectSocketType
 import stem.process
 from configparser import ConfigParser
@@ -79,7 +80,7 @@ def init_controller(port=None, path=None, 
set_custom_stream_settings=True):
 def is_bootstrapped(c):
 try:
 line = c.get_info('status/bootstrap-phase')
-except Exception as e:
+except (ControllerError, InvalidArguments, ProtocolError) as e:
 log.exception("Error trying to check bootstrap phase %s", e)
 return False
 state, _, progress, *_ = line.split()



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit a398aaffedaa4270aa16a4e25cbba71c910cb7fa
Author: juga0 
Date:   Wed Jul 4 08:04:14 2018 +

Replace Exception by the possible exceptions
---
 sbws/lib/relaylist.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index d0c903c..f674b62 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -39,7 +39,7 @@ class Relay:
 else:
 try:
 self._desc = cont.get_server_descriptor(fp, default=None)
-except Exception as e:
+except (DescriptorUnavailable, ControllerError) as e:
 log.exception("Exception trying to get desc %s", e)
 
 def _from_desc(self, attr):



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [sbws/master] Replace Exception by the possible exceptions

2018-07-11 Thread pastly
commit 3ee931dbdb43386fec8274c311e33ca94d93293f
Author: juga0 
Date:   Wed Jul 4 08:01:56 2018 +

Replace Exception by the possible exceptions
---
 sbws/lib/relaylist.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index bb59a3b..e623ab7 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -1,6 +1,6 @@
 from stem.descriptor.router_status_entry import RouterStatusEntryV3
 from stem.descriptor.server_descriptor import ServerDescriptor
-from stem import Flag
+from stem import Flag, DescriptorUnavailable, ControllerError
 from stem.util.connection import is_valid_ipv4_address
 from stem.util.connection import is_valid_ipv6_address
 import random
@@ -30,7 +30,7 @@ class Relay:
 else:
 try:
 self._ns = cont.get_network_status(fp, default=None)
-except Exception as e:
+except (DescriptorUnavailable, ControllerError) as e:
 log.exception("Exception trying to get ns %s", e)
 self._ns = None
 if desc is not None:



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits