Commit 407d20fe authored by Vincent Pelletier's avatar Vincent Pelletier

Replace print + sys.exit with parser.error .

parent a11c5e4f
......@@ -1180,14 +1180,12 @@ def main():
elif DURATION_S_FORMAT in args.logformat:
getDuration = lambda x: int(x.group('duration_s')) * US_PER_S
else:
print >> sys.stderr, 'Neither %D nor %T are present in logformat, apdex ' \
'cannot be computed.'
sys.exit(1)
parser.error('Neither %D nor %T are present in logformat, apdex '
'cannot be computed.')
if args.match_servername is not None and \
args.match_servername not in args.logformat:
print >> sys.stderr, '--match-servername %s requested, but missing ' \
'from logformat.' % args.match_servername
sys.exit(1)
parser.error('--match-servername %s requested, but missing '
'from logformat.' % args.match_servername)
get_url_prefix = server_name_group_dict.get(args.match_servername,
lambda _: '')
line_regex = ''
......@@ -1239,9 +1237,8 @@ def main():
if default_site is None:
default_action = None
if not [None for _, _, x in site_list if x is not None]:
print >> sys.stderr, 'None of --default, --erp5-base and --base were ' \
'specified, nothing to do.'
sys.exit(1)
parser.error('None of --default, --erp5-base and --base were '
'specified, nothing to do.')
else:
default_action = partial(GenericSiteStats, suffix=lambda x: x)
site_caption_dict[None] = default_site
......@@ -1252,8 +1249,7 @@ def main():
file_count = len(infile_list)
per_site = {}
if '-' in args.state_file and '-' in infile_list:
print >> sys.stderr, 'stdin cannot be used both as log and state input.'
sys.exit(1)
parser.error('stdin cannot be used both as log and state input.')
loading_start_time = time.time()
for state_file_name in args.state_file:
print >> sys.stderr, 'Loading', state_file_name, '...',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment