On Fri, 15 Sep 2017 19:14:04 -0400, Augie Fackler wrote: > # HG changeset patch > # User Augie Fackler <r...@durin42.com> > # Date 1505515049 14400 > # Fri Sep 15 18:37:29 2017 -0400 > # Node ID 662bbd6d96952985eff807f424dd128663724672 > # Parent 209120041d12b524648fa856732aa404dfedd91d > bundle2: raise a more helpful error if building a bundle part header fails > > I've tripped on this several times now, and am tired of debugging. Now > the header parts are part of the error message when the ''.join() > fails, which makes debugging obvious. > > diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py > --- a/mercurial/bundle2.py > +++ b/mercurial/bundle2.py > @@ -1050,7 +1050,11 @@ class bundlepart(object): > header.append(key) > header.append(value) > ## finalize header > - headerchunk = ''.join(header) > + try: > + headerchunk = ''.join(header) > + except TypeError: > + raise TypeError(u'Found a non-bytes trying to ' > + u'build bundle part header: %r' % header)
I was making it a r'' string, but probably ProgrammingError would be better. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel