mercurial/commands.py
changeset 1177 862f53c1d0f9
parent 1147 d32b91ebad5d
child 1187 120aa5fc7ced
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1386,7 +1386,10 @@ def serve(ui, repo, **opts):
         if opts[o]:
             ui.setconfig("web", o, opts[o])
 
-    httpd = hgweb.create_server(repo)
+    try:
+        httpd = hgweb.create_server(repo)
+    except socket.error, inst:
+        raise util.Abort('cannot start server: ' + inst.args[1])
 
     if ui.verbose:
         addr, port = httpd.socket.getsockname()