Skip to content

Commit

Permalink
Merge pull request #14 from cynthia/r/init-error
Browse files Browse the repository at this point in the history
Make general init failure point users to the FM.
  • Loading branch information
jgraham committed Aug 12, 2014
2 parents 50339d5 + c431f7e commit ec9b10b
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions wptserve/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,17 +329,21 @@ def __init__(self, host="127.0.0.1", port=8000,
if use_ssl:
assert certificate is not None and os.path.exists(certificate)

self.httpd = server_cls((host, port),
handler_cls,
self.router,
self.rewriter,
config=config,
bind_hostname=bind_hostname,
use_ssl=use_ssl,
certificate=certificate)
self.started = False

_host, self.port = self.httpd.socket.getsockname()
try:
self.httpd = server_cls((host, port),
handler_cls,
self.router,
self.rewriter,
config=config,
bind_hostname=bind_hostname,
use_ssl=use_ssl,
certificate=certificate)
self.started = False

_host, self.port = self.httpd.socket.getsockname()
except Exception:
logger.error('Init failed! You may need to modify your hosts file. Refer to README.md.');
raise

def start(self, block=False):
"""Start the server.
Expand Down

0 comments on commit ec9b10b

Please sign in to comment.