Skip to content

Commit 93815dc

Browse files
rikvaAutomatedTester
authored andcommitted
Add ProxyServerError and raise it instead of Exception
1 parent 3d2204d commit 93815dc

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

browsermobproxy/exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ProxyServerError(StandardError):
2+
pass

browsermobproxy/server.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import time
66

77
from .client import Client
8+
from .exceptions import ProxyServerError
89

910

1011
class RemoteServer(object):
@@ -76,8 +77,8 @@ def __init__(self, path='browsermob-proxy', options=None):
7677
break
7778

7879
if not os.path.isfile(path) and exec_not_on_path:
79-
raise Exception("Browsermob-Proxy binary couldn't be found in path"
80-
" provided: %s" % path)
80+
raise ProxyServerError("Browsermob-Proxy binary couldn't be found "
81+
"in path provided: %s" % path)
8182

8283
self.path = path
8384
self.host = 'localhost'
@@ -118,12 +119,12 @@ def start(self, options=None):
118119
"Check {0}"
119120
"for a helpful error message.".format(self.log_file))
120121

121-
raise Exception(message)
122+
raise ProxyServerError(message)
122123
time.sleep(retry_sleep)
123124
count += 1
124125
if count == retry_count:
125126
self.stop()
126-
raise Exception("Can't connect to Browsermob-Proxy")
127+
raise ProxyServerError("Can't connect to Browsermob-Proxy")
127128

128129
def stop(self):
129130
"""

0 commit comments

Comments
 (0)