~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Martin Pool
  • Date: 2006-06-04 22:13:03 UTC
  • mto: This revision was merged to the branch mainline in revision 1797.
  • Revision ID: mbp@sourcefrog.net-20060604221303-1f902e4ec57868d4
Show short form for OSError and IOError too

Show diffs side-by-side

added added

removed removed

Lines of Context:
234
234
        print >>err_file, "bzr: broken pipe"
235
235
    elif isinstance(exc_object, KeyboardInterrupt):
236
236
        print >>err_file, "bzr: interrupted"
237
 
    elif isinstance(exc_info[1], (BzrError, BzrNewError)):
 
237
    elif isinstance(exc_info[1], (IOError, OSError, BzrError, BzrNewError)):
238
238
        report_user_error(exc_info, err_file)
239
239
    else:
240
240
        report_bug(exc_info, err_file)
242
242
 
243
243
# TODO: Should these be specially encoding the output?
244
244
def report_user_error(exc_info, err_file):
245
 
    exc_type, exc_object, exc_tb = exc_info
246
 
    print >>err_file, "bzr: ERROR:",
247
 
    try:
248
 
        print >>err_file, str(exc_object)
249
 
    except Exception, formatting_exc:
250
 
        # XXX: is this really better than just letting it run up?
251
 
        print >>err_file, \
252
 
                '(error formatting exception of type %s: %s)' \
253
 
                % (exc_type, formatting_exc)
 
245
    print >>err_file, "bzr: ERROR:", str(exc_info[1])
254
246
 
255
247
 
256
248
def report_bug(exc_info, err_file):