324
324
log_exception_quietly()
325
325
if (isinstance(exc_object, IOError)
326
326
and getattr(exc_object, 'errno', None) == errno.EPIPE):
327
print >>err_file, "bzr: broken pipe"
327
err_file.write("bzr: broken pipe\n")
328
328
return errors.EXIT_ERROR
329
329
elif isinstance(exc_object, KeyboardInterrupt):
330
print >>err_file, "bzr: interrupted"
330
err_file.write("bzr: interrupted\n")
331
331
return errors.EXIT_ERROR
332
332
elif not getattr(exc_object, 'internal_error', True):
333
333
report_user_error(exc_info, err_file)
351
351
if 'error' in debug.debug_flags:
352
352
report_bug(exc_info, err_file)
354
print >>err_file, "bzr: ERROR:", str(exc_info[1])
354
err_file.write("bzr: ERROR:" + ' ' + str(exc_info[1]) + '\n')
357
357
def report_bug(exc_info, err_file):
358
358
"""Report an exception that probably indicates a bug in bzr"""
360
360
exc_type, exc_object, exc_tb = exc_info
361
print >>err_file, "bzr: ERROR: %s.%s: %s" % (
362
exc_type.__module__, exc_type.__name__, exc_object)
361
err_file.write("bzr: ERROR: %s.%s: %s\n" % (
362
exc_type.__module__, exc_type.__name__, exc_object))
364
364
traceback.print_exception(exc_type, exc_object, exc_tb, file=err_file)
366
print >>err_file, 'bzr %s on python %s (%s)' % \
366
err_file.write('bzr %s on python %s (%s)\n' % \
367
367
(bzrlib.__version__,
368
368
'.'.join(map(str, sys.version_info)),
370
print >>err_file, 'arguments: %r' % sys.argv
370
err_file.write('arguments: %r\n' % sys.argv)
372
372
'encoding: %r, fsenc: %r, lang: %r\n' % (
373
373
osutils.get_user_encoding(), sys.getfilesystemencoding(),