~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Martin Pool
  • Date: 2006-06-15 05:36:34 UTC
  • mto: This revision was merged to the branch mainline in revision 1797.
  • Revision ID: mbp@sourcefrog.net-20060615053634-4fd52ba691855659
Clean up many exception classes.

Errors indicating a user error are now shown with is_user_error on the
exception; use this rather than hardcoding a list of exceptions that should be
handled this way.

Exceptions now inherit from BzrNewException where possible to use consistent
formatting method.

Remove rather obsolete docstring test on Branch.missing_revisions.

Remove dead code from find_merge_base.


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], (IOError, OSError, BzrError, BzrNewError)):
 
237
    elif getattr(exc_object, 'is_user_error', False):
 
238
        report_user_error(exc_info, err_file)
 
239
    elif isinstance(exc_object, (OSError, IOError)):
 
240
        # Might be nice to catch all of these and show them as something more
 
241
        # specific, but there are too many cases at the moment.
238
242
        report_user_error(exc_info, err_file)
239
243
    else:
240
244
        report_bug(exc_info, err_file)
253
257
    print >>err_file
254
258
    traceback.print_exception(exc_type, exc_object, exc_tb, file=err_file)
255
259
    print >>err_file
256
 
    print >>err_file, 'bzr %s invoked on python %s (%s)' % \
 
260
    print >>err_file, 'bzr %s on python %s (%s)' % \
257
261
                       (bzrlib.__version__,
258
262
                        '.'.join(map(str, sys.version_info)),
259
263
                        sys.platform)
260
 
    print >>err_file, '  arguments: %r' % sys.argv
 
264
    print >>err_file, 'arguments: %r' % sys.argv
261
265
    print >>err_file
262
266
    print >>err_file, "** please send this report to bazaar-ng@lists.ubuntu.com"
263
 
    print >>err_file, "   with a description of how and when the problem occurred"