Added error handling for a bad default network.

This commit is contained in:
Jeremy Fincher 2004-07-29 07:39:30 +00:00
parent 9bfb616623
commit 5f1a08f6e0

View File

@ -206,7 +206,16 @@ if __name__ == '__main__':
# We could add an option for this, but we'll wait until it's requested. # We could add an option for this, but we'll wait until it's requested.
defaultNetwork = conf.supybot.networks.default() defaultNetwork = conf.supybot.networks.default()
try:
network = conf.supybot.networks.get(defaultNetwork) network = conf.supybot.networks.get(defaultNetwork)
except registry.NonExistentRegistryEntry:
sys.stderr.write('No default network defined. Add a line to your ')
sys.stderr.write('registry that says (without the quotes), "supybot.')
sys.stderr.write('networks.default: <name>" where <name> is the name ')
sys.stderr.write('of the network you\'d like to connect to by ')
sys.stderr.write('default when the bot starts.')
sys.exit(-1)
server = network.server() server = network.server()
if ':' in server: if ':' in server:
serverAndPort = server.split(':', 1) serverAndPort = server.split(':', 1)