[PATCH V2] error: make HintException a mix-in class not derived from BaseException (API)

Yuya Nishihara yuya at tcha.org
Mon Jul 11 08:54:11 EDT 2016


On Mon, 11 Jul 2016 05:23:09 +0000, Kostia Balytskyi wrote:
> I would also argue in favor of MercurialException class to allow
> differentiation between our exceptions and all other ones.

That might be somewhat useful to eliminate "except Exception:" at
dispatch.runcommand(). But we would still have to catch IOError,
KeyboardInterrupt, etc. as well.

> > +class Hint(object):
> > +    """Mix-in to provide a hint of an error
> > +
> > +    This should come first in the inheritance list to consume **kw and pass
> > +    only *args to the exception class.
> > +    """
> >      def __init__(self, *args, **kw):
> > -        Exception.__init__(self, *args)
> > +        super(Hint, self).__init__(*args)
> >          self.hint = kw.get('hint')
> 
> should we do kw.pop('hint', None) and then forward **kw?

Sure, send V3.


More information about the Mercurial-devel mailing list