Browse Source

better error message with config.json format

1.4
clowwindy 11 years ago
parent
commit
34843c6a91
  1. 6
      shadowsocks/local.py
  2. 7
      shadowsocks/server.py

6
shadowsocks/local.py

@ -198,7 +198,11 @@ def main():
if config_path:
logging.info('loading config from %s' % config_path)
with open(config_path, 'rb') as f:
config = json.load(f)
try:
config = json.load(f)
except ValueError as e:
logging.error('found an error in config.json: %s', e.message)
sys.exit(1)
else:
config = {}

7
shadowsocks/server.py

@ -150,8 +150,13 @@ def main():
config_path = value
if config_path:
logging.info('loading config from %s' % config_path)
with open(config_path, 'rb') as f:
config = json.load(f)
try:
config = json.load(f)
except ValueError as e:
logging.error('found an error in config.json: %s', e.message)
sys.exit(1)
logging.info('loading config from %s' % config_path)
else:
config = {}

Loading…
Cancel
Save