Bug 681840 - Print helpful warning when starting test HTTP server fails. r=philikon DONTBUILD

This commit is contained in:
Richard Newman 2011-08-26 15:23:24 -07:00
parent c2d667b7f6
commit cb8ed04e8d

View File

@ -7,10 +7,21 @@ function new_timestamp() {
function httpd_setup (handlers) {
let server = new nsHttpServer();
let port = 8080;
for (let path in handlers) {
server.registerPathHandler(path, handlers[path]);
}
server.start(8080);
try {
server.start(port);
} catch (ex) {
_("==========================================");
_("Got exception starting HTTP server on port " + port);
_("Error: " + Utils.exceptionStr(ex));
_("Is there a process already listening on port " + port + "?");
_("==========================================");
do_throw(ex);
}
return server;
}