~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/patches.py

  • Committer: Martin Pool
  • Date: 2007-05-12 19:05:12 UTC
  • mto: This revision was merged to the branch mainline in revision 2723.
  • Revision ID: mbp@sourcefrog.net-20070512190512-azo21f2tu50i46g4
Update some too-general exception blocks

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
        raise MalformedHunkHeader("Does not start and end with @@.", line)
100
100
    try:
101
101
        (orig, mod) = line[3:-4].split(" ")
102
 
    except Exception, e:
 
102
    except (ValueError, IndexError), e:
103
103
        raise MalformedHunkHeader(str(e), line)
104
104
    if not orig.startswith('-') or not mod.startswith('+'):
105
105
        raise MalformedHunkHeader("Positions don't start with + or -.", line)
106
106
    try:
107
107
        (orig_pos, orig_range) = parse_range(orig[1:])
108
108
        (mod_pos, mod_range) = parse_range(mod[1:])
109
 
    except Exception, e:
 
109
    except (ValueError, IndexError), e:
110
110
        raise MalformedHunkHeader(str(e), line)
111
111
    if mod_range < 0 or orig_range < 0:
112
112
        raise MalformedHunkHeader("Hunk range is negative", line)